OpenSprinkler Forums OpenSprinkler Unified Firmware OS 2.2 Controllers Reply To: OS 2.2 Controllers

#74142

Ray
Keymaster

While debugging this, I found the root cause of the issue: weather.opensprinkler.com is now proxied by Cloudflare (CF), and as a result, the return of the weather script has additional header data added by Cloudflare. This makes the result (including header) larger than 512 bytes. The EtherCard library used in early firmwares such as 2.1.7 apparently has a limitation which does not allow it to handle received packet larger than 512 bytes, therefore the weather query fails. We are looking into how to address this issue, one possibility is to see whether the additional headers added by Cloudflare can be reduced or removed; if that’s not possible, the only viable option is to launch a weather service elsewhere (you can set up a weather server yourself, using a raspberry pi for example), and change OpenSprinkler settings to point to your new server which is not proxied by CF. This should be able to solve the problem.

Coincidentally, the larger result data might also affect OpenSprinkler 2.3 and 3.0 running 2.1.9(9) or (10) — what happens here is that although the Ethernet library is able to handle any size incoming data, it still splits the packet into chunks of no more than 512 bytes each. When I wrote the firmware, I did not anticipate the weather query result can be larger than just a few hundred bytes, so the current code will result in later chunks overwriting earlier chunks. So what it’s getting is not the complete weather query result, rather it’s the last chunk. Fortunately because most of the data is header data, the actual weather data needed by the firmware is in the last chunk, so after peeling away header, in most cases it still has the correct weather data. However, there is clearly a problem in that this leaves the firmware vulnerable to variations in the header data or weather query result, in some cases it can lead to failure of parsing the weather result. In any case, I have fixed this issue and will shortly make minor revision 2.1.9(11) available. If you are observing your OpenSprinkler getting weather status ‘Offline’ it is very likely due to this bug, whether you are using WiFi or wired Ethernet. I will make a separate post shortly.