2019 May 09, 04:24 AM
(2019 May 08, 05:08 PM)dan Wrote: Looks like 7timer is pretty easy to use.
I made a short Python program to get the predicted amount of precipitation for today.
Code:from __future__ import print_function
import json
import urllib2
lat = 23.09 # Example. Replace with your latitude
lon = 113.17 # Example. Replace with your longitude
day_precip = 0
url = "http://www.7timer.info/bin/api.pl?lon={}&lat={}&product=civil&output=json".format(lon, lat)
request = urllib2.Request(url)
data = urllib2.urlopen(request).read()
py_data = json.loads(data)
day_data = py_data["dataseries"][:8]
for i in day_data:
day_precip += i["prec_amount"]
print("predicted precip (mm): ", day_precip)
Note that you do not need a key to access the data just your longitude and latitude which you can find from google maps and other sources.
I will try to make a new weather plugin using 7timer. It may be a few days.
Thanks Dan, that would be brilliant, let me know if I can test or something to help. Would it be possible to put some kind of indication on the GUI that indicates the system has been delay because of rain prediction?