OpenSprinkler Forums OpenSprinkler Unified Firmware OpenSprinkler firmware 2.1.9(11) is available (weather query bug fix)

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #74143

    Ray
    Keymaster

    Hi, today while debugging an issue with an earlier version of OpenSprinkler firmware, I discovered a bug in the current firmware code that can lead to failure in the parsing of weather query. It doesn’t happen all the time but it can lead to ‘Weather Service’ shown as ‘Offline’ in the System Diagnostics. Long story short, recently we’ve change weather.opensprinkler.com to be proxied by CloudFlare (CF) for better protection against DDoS attacks. What I didn’t know is that CF adds additional header data to the result of a HTTP request. This consequently makes the weather query result (including header) larger than 512 bytes. Apparently both the Ethernet library and WiFi library used by OpenSprinkler firmware splits http request results into chunks of 512 bytes, so when the result is larger than 512 bytes, it will get split into multiple chunks. The firmware code currently has a bug that only keeps the last chunk. In most cases, the bulk of the data is header, and the actual weather query result is no more than a hundred bytes, so it lands in the last chunk and therefore can still be parsed. This means usually the weather query is still successful. But the bug makes it vulnerable to variations in the header data and the query result data. If you observe that sometimes the weather service status is ‘offline’, it is likely caused by this bug.

    In quick summary, the firmware code worked fine at the time of its release because the weather query result (including header) was no more than a couple hundre bytes long. But the recent change in enabling CF proxy broke this assumption therefore can trigger issues in some cases.

    I’ve fixed this issue now and has released firmware 2.1.9(11) (i.e. minor revision 11). If you have OpenSprinkler hardware 2.3 or 3.0/3.1/3.2 you should upgrade to this firmware, whether you are using WiFi or wired Ethernet, as it affects both WiFi and wired Ethernet. As usual, instructions on firmware upgrade can be found here:
    https://openthings.freshdesk.com/support/solutions/articles/5000381694
    OSPi does not seem to be affected as its Ethernet functions do not seem to split the packets into multiple chunks (although we did the same fix to the code for OSPi). For OpenSprinkler 3.x running wired Ethernet, this firmware is compiled with the latest UIPEthernet library (same as used in firmware 2.1.9(10)). I will compile it with EtherENC library as well and release that shortly — from what I observe, it seems the latest UIPEthernet library is more reliable than EtherENC, which is why I chose UIPEthernet.

    Let me know if you have any questions. Thanks.

    #74183

    skyynet
    Participant

    Update still not possible via Ethernet? I get a blank screen after chosing file.

    #74186

    Ray
    Keymaster

    OTA update through wired Ethernet will be supported in the next firmware, once we move to ESP8266 core 3.0.2, which unifies wired Ethernet and WiFi. Currently wired Ethernet is done through a separate library, and it doesn’t support OTA update.

    #74289

    franzstein
    Participant

    Hello Ray,
    I’ve updated my OpenSprinkler Hardware Version 3.1 – DC to Firmware 2.1.9 (11). The weather updates are working now for both Dark Sky and Weather Underground. I haven’t tested it with with my Raspberry Pi Weather Server installation yet, as my Raspberry Pi is currently not working.
    Thanks a lot.
    Franz.

    #74337

    Matt
    Participant

    Hi Ray,

    I’ve been having this Weather Service “Offline” issue.

    I just updated to 2.1.9(11) and it unfortunately hasn’t resolved the problem for me (see attachments).

    Any other ideas on how I can troubleshoot? The weather service seems to work intermittently, but it’s not reliable enough to ensure the sprinklers run correctly.

    Thanks for your support.
    Matt

    #74343

    Ray
    Keymaster

    Sorry, I really don’t know. We’ve tried our best, and also fixed the original problem (cloudflare adding extra header information) so even without firmware 2.1.9(11) the problem should be gone by now. I don’t know why you are getting offline error.

    #74347

    Matt
    Participant

    It’s strange because it seems inconsistent.

    For example, it has been ~24 hours since I made my last post (which showed the weather service offline), and it now shows as online (see new attachment). There have been no changes in my environment in that time.

    So something still appears to be a little flakey.

    I’d be happy to spend time helping you troubleshoot this it that would be helpful? I’m sure others must still be facing the same issue. I’d really love to get this to work, OpenSprinker is otherwise perfect for that I need!

    Cheers
    Matt

    #74351

    Ray
    Keymaster

    The firmware issues a weather query every 6 hours by default. So if one call fails, that doesn’t mean all the subsequent calls will fail too. A failure could be due to a number of reasons, DNS time out, server connection time out, or maybe server overload and not responding etc.

    #74357

    Matt
    Participant

    Is there a way to shorten the query time and/or retry on failure?

    I worry that a few failures in a row could lead to a fairly incorrect watering level.

    #74360

    Ray
    Keymaster

    Sure, this can be easily changed by shortening the check weather interval time:
    https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/main.cpp#L57
    you can customize it and recompile the firmware.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware OpenSprinkler firmware 2.1.9(11) is available (weather query bug fix)