OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Custome Water Restrictions › Reply To: Custome Water Restrictions
Ray
It’s kind of hard to explain how the weather script works. Here is the simplified version. First, the firmware sends a weather call in this function:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/weather.cpp#L126
as you can see, it takes the weather script location (which you can modify from the /su page), attaches a bunch of parameters (notably the location, and the WUnderground API key), and issues an HTTP GET command. The script is assumed to be a python script (but you can use other scripting languages as well). Upon returning, this is the callback function that handles the return data:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/weather.cpp#L49
If you write your own custom script, it just needs to return data in the format that the above function can parse. For example this is what the current script returns:
http://weather.opensprinkler.com/weather0.py?loc=01002