Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup fails if ISY is still starting up #297

Open
bdraco opened this issue Sep 26, 2022 · 3 comments
Open

Startup fails if ISY is still starting up #297

bdraco opened this issue Sep 26, 2022 · 3 comments

Comments

@bdraco
Copy link
Contributor

bdraco commented Sep 26, 2022

I had a power outage today and things didn't startup in the right order which resulted in the below.

The failure was transient as it just happened that hass started up while the isy was starting (which would probably be a common thing during a power event)

2022-09-26 01:38:01.303 ERROR (MainThread) [pyisy] ISY Reported an Invalid Command Received.
2022-09-26 01:38:01.382 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry House (192.168.106.67) for isy994
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 365, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/isy994/__init__.py", line 197, in async_setup_entry
    _categorize_programs(hass_isy_data, isy.programs)
  File "/usr/src/homeassistant/homeassistant/components/isy994/helpers.py", line 332, in _categorize_programs
    folder = programs.get_by_name(f"{DEFAULT_PROGRAM_STRING}{platform}")
  File "/usr/local/lib/python3.10/site-packages/pyisy/programs/__init__.py", line 323, in get_by_name
    for i in range(len(self.addresses)):
TypeError: object of type 'NoneType' has no len()

``
@shbatm
Copy link
Collaborator

shbatm commented Sep 27, 2022

I don't know of any way to detect via REST if the ISY is still loading.

I can handle this error (the defaults in the init function arguments should be =[] not =None), but that may also lead to an issue where the ISY loads "successfully" but doesn't actually load one of the modules because it receives a partial/empty response.

I'll fix the init function definitions when I get a chance.

@bdraco
Copy link
Contributor Author

bdraco commented Sep 27, 2022

Thinking about this we might just want to catch it in hass and retry since even if we could determine if the isy is loading it doesn't mean it's still loading on the next request as it would be race prone

@bdraco
Copy link
Contributor Author

bdraco commented Sep 28, 2022

I added a check in HA in the mean time

Martin suggested wrapping the problem in a named exception

home-assistant/core#79163 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants