Losing OpenSprinkler Integration on Restart

I recently upgraded to 0.114.4 and after a restart this evening I noticed that my OpenSprinkler integration was all greyed out. I looked in the logs and saw this:

Timeout fetching OpenSprinkler resource status data

Then a few of these:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_add_entity
    device_info = entity.device_info
  File "/config/custom_components/opensprinkler/__init__.py", line 134, in device_info
    model = controller.hardware_version_name or "Unknown"
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 471, in hardware_version_name
    if self.hardware_version == HARDWARE_VERSION_OSPI:
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 466, in hardware_version
    return self._get_option("hwv")
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 274, in _get_option
    return self._get_options()[option]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 280, in _get_options
    return self._retrieve_state()["options"]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 268, in _retrieve_state
    raise OpenSprinklerNoStateError("No state. Please refresh")
pyopensprinkler.OpenSprinklerNoStateError: No state. Please refresh

I removed the integration and reinstalled it and everything was back online. I was messing with something else and needed to restart HA again, when it came back up the OpenSprinkler integration was busted again. :frowning:

I did the remove/re-add again to bring it back. Anyone else experiencing this or know what I need to do to keep it from going away on a restart?

Thanks,
-Greg

@vinteo, I’m using the HACS OpenSprinkler add on. Are you on 0.114.4? If you are, have you seen this happen? You have any ideas what might cause this? I dunno if it is related to the version but I think this problem is pretty recent.

Did you try restarting the OpenSprinkler device as well?

Thanks for the quick response. For “fun” I just tried that:

  1. Reboot OpenSprinkler device
  2. Restart Home Assistant
  3. When it came up, the open sprinkler devices were all greyed out again. :frowning:
  4. I have to delete the integration and reinstall it. :cry:

Do you have any ideas for debug of this?

Anything in the logs? I would just try restarting HA a few times rather than reinstalling

It is very consistent on my raspberry pi 3. When I restart HA it seems to drop it every time with this message in the logs:

image

I’ll try restarting it a couple times and see if it recovers.

I’ve tried multiple restarts (same thing in the logs every time):

2020-09-03 07:06:49 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for opensprinkler which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-09-03 07:07:12 ERROR (MainThread) [custom_components.opensprinkler] Timeout fetching OpenSprinkler resource status data
2020-09-03 07:07:18 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up opensprinkler platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_add_entity
    device_info = entity.device_info
  File "/config/custom_components/opensprinkler/__init__.py", line 134, in device_info
    model = controller.hardware_version_name or "Unknown"
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 471, in hardware_version_name
    if self.hardware_version == HARDWARE_VERSION_OSPI:
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 466, in hardware_version
    return self._get_option("hwv")
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 274, in _get_option
    return self._get_options()[option]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 280, in _get_options
    return self._retrieve_state()["options"]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 268, in _retrieve_state
    raise OpenSprinklerNoStateError("No state. Please refresh")
pyopensprinkler.OpenSprinklerNoStateError: No state. Please refresh
2020-09-03 07:07:18 ERROR (MainThread) [homeassistant.components.switch] Error while setting up opensprinkler platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_add_entity
    device_info = entity.device_info
  File "/config/custom_components/opensprinkler/__init__.py", line 134, in device_info
    model = controller.hardware_version_name or "Unknown"
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 471, in hardware_version_name
    if self.hardware_version == HARDWARE_VERSION_OSPI:
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 466, in hardware_version
    return self._get_option("hwv")
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 274, in _get_option
    return self._get_options()[option]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 280, in _get_options
    return self._retrieve_state()["options"]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 268, in _retrieve_state
    raise OpenSprinklerNoStateError("No state. Please refresh")
pyopensprinkler.OpenSprinklerNoStateError: No state. Please refresh
2020-09-03 07:07:21 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up opensprinkler platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_add_entity
    device_info = entity.device_info
  File "/config/custom_components/opensprinkler/__init__.py", line 134, in device_info
    model = controller.hardware_version_name or "Unknown"
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 471, in hardware_version_name
    if self.hardware_version == HARDWARE_VERSION_OSPI:
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 466, in hardware_version
    return self._get_option("hwv")
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 274, in _get_option
    return self._get_options()[option]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 280, in _get_options
    return self._retrieve_state()["options"]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 268, in _retrieve_state
    raise OpenSprinklerNoStateError("No state. Please refresh")
pyopensprinkler.OpenSprinklerNoStateError: No state. Please refresh

I tried removing all the add-on switches and sensors I wrapped around the HACS implementation and that didn’t help. I even tried downgrading to 0.114.3 and that didn’t help either. Is there a way to enable extra debug messaging on the OpenSprinkler HACS startup process to see where this is breaking?

Bah, I think it’s my OpenSprinkler ESP8266 module dying. Over the last few days the thing got worse and worse and finally I couldn’t connect to it anymore. I went out and reset it by pulling the power and it came back but now it’s flaking in and out:
image

The thing that’s really annoying is that the AP is literally line-of-sight 10 feet away so I’m pretty sure I need to swap out the ESP8266. Good thing is, I made the OpenSprinkler box so I could swap out the module. Just need to program a new one and switch them now. :neutral_face:

I am getting this also on one of my rpis (3), but only one, the other one (4) works fine.
I tried updating opensprinkler to the newest version and restarting, it still seems to be happening and I cannot get it working on the second pi. Is it possible to implement some kind of retry of setup after a while?
Reinstalling the integration through hacs doesn’t help.
I am running opensprinkler on another RPI 3 and it works flawlessly through HASS on RPI 4.

I replaced the esp8266 on that device and it seems to work better but Home Assistant still disconnects the device on restart. Good thing that someone added the “Reload” option because that hooks it up again without issue. Seems like maybe the high demand on the little pi engine ends up timing out the sprinkler and once it’s gone it’s gone.

1 Like

This is like clockwork. If I restart Home Assistant, when it comes back I have three errors in my logs relating to OpenSprinkler and the opensprinkler devices are all unavailable and greyed out. I’ve rebooted probably 5-6 times over the last few days and every time the thing is unavailable when “Home Assistant has started” message appears.

This is what the errors look like:

Error while setting up opensprinkler platform for switch
4:04:29 PM – Switch (ERROR)
Error while setting up opensprinkler platform for binary_sensor
4:04:29 PM – Binary sensor (ERROR)
Timeout fetching OpenSprinkler resource status data
4:04:25 PM – OpenSprinkler (ERROR)

More detail:

Log Details (ERROR)
Logger: homeassistant.components.switch
Source: custom_components/opensprinkler/__init__.py:134
Integration: Switch (documentation, issues)
First occurred: 4:04:29 PM (1 occurrences)
Last logged: 4:04:29 PM

Error while setting up opensprinkler platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 201, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 310, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 371, in _async_add_entity
    device_info = entity.device_info
  File "/config/custom_components/opensprinkler/__init__.py", line 134, in device_info
    model = controller.hardware_version_name or "Unknown"
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 471, in hardware_version_name
    if self.hardware_version == HARDWARE_VERSION_OSPI:
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 466, in hardware_version
    return self._get_option("hwv")
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 274, in _get_option
    return self._get_options()[option]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 280, in _get_options
    return self._retrieve_state()["options"]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 268, in _retrieve_state
    raise OpenSprinklerNoStateError("No state. Please refresh")
pyopensprinkler.OpenSprinklerNoStateError: No state. Please refresh

and

Log Details (ERROR)
Logger: homeassistant.components.binary_sensor
Source: custom_components/opensprinkler/__init__.py:134
Integration: Binary sensor (documentation, issues)
First occurred: 4:04:29 PM (1 occurrences)
Last logged: 4:04:29 PM

Error while setting up opensprinkler platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 201, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 310, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 371, in _async_add_entity
    device_info = entity.device_info
  File "/config/custom_components/opensprinkler/__init__.py", line 134, in device_info
    model = controller.hardware_version_name or "Unknown"
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 471, in hardware_version_name
    if self.hardware_version == HARDWARE_VERSION_OSPI:
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 466, in hardware_version
    return self._get_option("hwv")
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 274, in _get_option
    return self._get_options()[option]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 280, in _get_options
    return self._retrieve_state()["options"]
  File "/usr/local/lib/python3.8/site-packages/pyopensprinkler/__init__.py", line 268, in _retrieve_state
    raise OpenSprinklerNoStateError("No state. Please refresh")
pyopensprinkler.OpenSprinklerNoStateError: No state. Please refresh

and

Log Details (ERROR)
Logger: custom_components.opensprinkler
Source: helpers/update_coordinator.py:147
Integration: OpenSprinkler (documentation)
First occurred: 4:04:25 PM (1 occurrences)
Last logged: 4:04:25 PM

Timeout fetching OpenSprinkler resource status data

I have to go into the integrations menu and manually click the reload on the opensprinkler integration for all the related entities to resume function (the reload operation never fails). The devices never seem to come back automatically once these three messages are seen in the log files.

1 Like