hass-opensprinkler: Logbook full of "unavailable" entries; log shows "Timeout fetching resource status"

First, let me say that I was very excited to find this Home Assistant integration!

A couple pieces of background info:

  • Home Assistant 2021.7.2
  • HACS 1.13.2
  • hass-opensprinkler (installed via HACS) 1.1.6

I am running with OS hardware version 2.3, with firmware 2.1.7 (I had previously tried upgrading to 2.1.9(7) but ran in to weird issues where after a few minutes, API calls would starting returning “result:2” (unauthorized) which required me to run with the “Ignore Password” option. I also had multiple occurrences of the clock doing a “time warp” (even though I have NTP sync enabled) which resulted in a watering program running twice on the same day!! I eventually downgraded back to 2.1.7 and things are once again stable. I opened a ticket with OpenSprinkler about the weirdness I saw after upgrading to 2.1.9(7), but they had not heard of problems like what I described.)

I recently found this integration and successfully added it to my Home Assistant config. Everything seemed to be working great, but then I noticed my Logbook was full of “OpenSprinkler * became unavailable” followed 5 seconds later by “OpenSprinkler * turned [on|off]” entries.

I checked my Home Assistant log, and it’s full of messages like this:

2021-07-16 02:45:55 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 02:46:50 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 02:48:00 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 02:48:20 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 02:49:10 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 05:01:10 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 06:49:45 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 06:55:50 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 06:57:05 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 06:57:35 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2021-07-16 06:58:30 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data

Hoping to reproduce the problem, I’ve been running this loop (the pw hash is for the default) polling the “all” endpoint every 5 seconds:

while true; do date; curl -v 'http://sprinkler/ja?pw=a6d82bced638de3def1e9bbb4983225c'; echo; sleep 5; done

but have not seen any failures.

Any idea what might be causing the timeouts in HA? My first thought is that it could be related to needing to supply the controller’s MAC address when you’re not running 2.1.9(4) or later, so maybe it’s ARP-related. (I have not yet looked at the code to see why this is a requirement…)

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Let me know how you guys go after running for a while, if it works I will add the change to the integration

I have this issue as well. The frequency of timeouts seemed too precise. I enabled debug log and tried to find out more. It looked like every 25th request times out with the defaults (5s scan interval, 10s timeout). Like clockwork.

Motivated by @eddyg, I tried querying the sprinkler using curl instead and see if I can reproduce this behavior. It turns out I can - it is important to add the timeout option (“-m 10” to mimic the integration). I then played with various request frequency and timeouts. I have concluded my opensprinkler fails to respond in a timely fashion for ~16s every ~125s. It does reply to ping requests, it does accept a connection and does accept the request, but it does not reply for the “black out” period of roughly 16s.

What is required is not changing the scan interval, but the TIMEOUT in init.py. The opensprinkler integration is not at fault here, but changing the timeout does resolve the frequent unavailability of entities as well as huge number of entries generated in Home Assistant because of the state changes.

I hope this helps.