Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Dark Sky API

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
bigmac
Posts: 159
Joined: Wed 13 May 2009 9:35 am
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: Raspbian wheezy
Location: Nr Ilkley, West Yorks, UK
Contact:

Dark Sky API

Post by bigmac »

Been looking at updating my forecast page as it looks like the free Meteorologica maps have stopped working. Found an app on IOS called Dark Sky and they also do an API (https://developer.forecast.io) to integrate onto your own website. The first 1000 API calls per day are free and then charged at $0.0001 per call after that.
Anyone else using Dark Sky and also how could I limit the number of calls so that if I hit 1000, it wouldn't make any more calls for the day as I can't fund it infinitesimally. Or perhaps someone could also advise how my site could maybe subsidise the cost through advertising?

Lots of thoughts and questions :D
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Dark Sky API

Post by water01 »

This Forecast page from Yr,no is free http://www.dmjsystems.co.uk/weather/forecast.php
David
Image
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Dark Sky API

Post by mcrossley »

bigmac wrote:Been looking at updating my forecast page as it looks like the free Meteorologica maps have stopped working. Found an app on IOS called Dark Sky and they also do an API (https://developer.forecast.io) to integrate onto your own website. The first 1000 API calls per day are free and then charged at $0.0001 per call after that.
Anyone else using Dark Sky and also how could I limit the number of calls so that if I hit 1000, it wouldn't make any more calls for the day as I can't fund it infinitesimally. Or perhaps someone could also advise how my site could maybe subsidise the cost through advertising?

Lots of thoughts and questions :D
If you get your server to fetch the data and add it to the page then you could cache the data locally on your server. You return the cached data unless it is stale (say older than 20 minutes) then the server refreshes from source. This is pretty standard, most of the 'template' scripts do this for Weather Underground etc. as they also have API hit limits.
bigmac
Posts: 159
Joined: Wed 13 May 2009 9:35 am
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: Raspbian wheezy
Location: Nr Ilkley, West Yorks, UK
Contact:

Re: Dark Sky API

Post by bigmac »

Ok, thanks gents. Food for thought, I will probably be back with more questions at a later date!
AllanG
Posts: 5
Joined: Mon 05 Oct 2009 7:19 am
Weather Station: WeatherDuino Pro2
Operating System: Windows 10 Pro
Location: Prescot, Merseyside

Re: Dark Sky API

Post by AllanG »

A little off topic, I hope the op will forgive me.
water01 wrote:This Forecast page from Yr,no is free http://www.dmjsystems.co.uk/weather/forecast.php
David, I came across the 10 day forecast available from yr.no a while ago and recently downloaded Henkka's script to use it. I've spent days - literally - trying to get it working and I'm now very close, but one problem obstinately remains... :groan:

On loading the page, my location and co-ordinates (Prescot, Merseyside) appear correctly but the sunrise and sunset times are way out. Apparently sr here is currently at 01:10 and ss 09:30 :lol: :o :o Seems the forecast is correct but "offset" by about 5-6 hours too.

However when I select Prescot from the dropdown list, nothing else changes but the correct times do appear. I thought the problem may be related to my web hosting being located in Denver, US, but completely removing the "server geo-ip" lines of code made no difference (and it seems Just Host don't use them anyway.)

You've obviously modified the script and it's running perfectly. Have you any thoughts about where my problem may be, if so they'd be very gratefully received!

In this location at least, the forecast has proved pretty accurate over most of the last week or so and it seems a really worthwhile addition if I can get the script to behave itself!

Should you want to have a look at the test page, url is http://www.prescotpages.co.uk/Weather_S ... yrtest.php

Allan.
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Dark Sky API

Post by water01 »

Have you set your default Timezone correctly in yr_xmlII.php

Code: Select all

$deftz = "Europe/London";
Failing that could I see a copy of your yr_xmlII.php script please.
David
Image
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Dark Sky API

Post by water01 »

OK I think I know what your problem is.

The yr-test.php is meant as a test program with you then loading your co-ordinates.

When you use it in reality you should edit yr_xmlII.php to set your defaults e.g.

Code: Select all

// Units
$useC = 1;		// Use Celsius, else F
$useKMH = 0;		// Use Km/h
$useMPH = 1;		// Use Mph, if both KMH and MPH is zero is default m/s used
$useHPA = 1;		// Use hPa, else inHg
$useMM= 0;		// Use mm, else in

// Timesettings, normal PHP/date-tags used
$datestyle = "d.m.Y";		// Style of short date
$timestyle = "H:i";		// Style of time
$longdate = "d.m.Y H:i";	// Style of long time + date
$deftz = "Europe/London";
$pagename = "forecast.php";

$geonameusr = "xxxxxxxxx"; // IMPORTANT! You need to signup at geonames.org (FREE), put username here

// Cachesettings etc. settings
$qarefetchSeconds = 3600;	// How often it refresh the cache, 3600 recommended
$imgdir = "images/";	// Icons-folder
$jsfolder = "jquery/";
$cssfolder = "css/";
$cachefolder = "/home/dmjsyste/public_html/weather/cache/";
$days = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Default place
$cod = "GB";
$cou = "United Kingdom";
$cit = "Binegar";
$lat = 51.2425;
$lon = -2.5394;
and make sure you have signed up for geonames.org and entered your name in $geonameusr
David
Image
AllanG
Posts: 5
Joined: Mon 05 Oct 2009 7:19 am
Weather Station: WeatherDuino Pro2
Operating System: Windows 10 Pro
Location: Prescot, Merseyside

Re: Dark Sky API

Post by AllanG »

Thanks for the suggestions, though I think I've already covered them. "Defaults" section of code is:

Code: Select all

// Units
$useC = 1;		// Use Celsius, else F
$useKMH = 0;		// Use Km/h
$useMPH = 1;		// Use Mph, if both KMH and MPH is zero is default m/s used
$useHPA = 1;		// Use hPa, else inHg
$useMM= 1;		// Use mm, else in

// Timesettings, normal PHP/date-tags used
$datestyle = "d.m.Y";		// Style of short date
$timestyle = "H:i";		// Style of time
$longdate = "d.m.Y H:i";	// Style of long time + date
$deftz = "Europe/London";
$pagename = "yrtest.php";

$geonameusr = "zzzzzz"; // IMPORTANT! You need to signup at geonames.org (FREE), put username here

// Cachesettings etc. settings
$qarefetchSeconds = 3600;	// How often it refresh the cache, 3600 recommended
$imgdir = "images/";	// Icons-folder
$jsfolder = "jquery/";
$cssfolder = "css/";
$cachefolder = "cache/";
$days = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Default place
$cod = "GB"; 
$cou = "United Kingdom";
$cit = "Prescot";
$lat = 53.42948;
$lon = -2.80031;
I do have a valid geonames account, have activated it for free services and amended the url to http://api.geonames.org/searchJSON in the script.

I'm just using the yr.test page to get the script working properly before I try and integrate it into my own weatherpage template.

Thanks again for the suggestions.

Allan.
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Dark Sky API

Post by water01 »

I can only think that with the test page it defaults to the Timezone of your server whereas if you build a Forecast page and call yr_xmlII.php without the gubbins that does the look up in the yr-test.php the correct timezone will be set before it asks for the Forecast from yr_no.
David
Image
AllanG
Posts: 5
Joined: Mon 05 Oct 2009 7:19 am
Weather Station: WeatherDuino Pro2
Operating System: Windows 10 Pro
Location: Prescot, Merseyside

Re: Dark Sky API

Post by AllanG »

I thought / hoped I'd tried virtually everything I could find in code and you've more or less confirmed that for me. I'll try putting together my own page and see how it goes. Many thanks.

Allan.
Post Reply