natekspencer / hacs-pura

Home Assistant integration for Pura smart fragrance diffusers
MIT License
19 stars 2 forks source link

Nightlight? #49

Closed thenoid closed 8 months ago

thenoid commented 8 months ago

The problem

homeassistant    | 2024-03-01 20:28:38.824 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
homeassistant    | Traceback (most recent call last):
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _handle_refresh_interval
homeassistant    |     await self._async_refresh(log_failures=True, scheduled=True)
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 412, in _async_refresh
homeassistant    |     self.async_update_listeners()
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
homeassistant    |     update_callback()
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update
homeassistant    |     self.async_write_ha_state()
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 989, in async_write_ha_state
homeassistant    |     self._async_write_ha_state()
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1110, in _async_write_ha_state
homeassistant    |     state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
homeassistant    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1047, in __async_calculate_state
homeassistant    |     state = self._stringify_state(available)
homeassistant    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 995, in _stringify_state
homeassistant    |     if (state := self.state) is None:
homeassistant    |                  ^^^^^^^^^^
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1600, in state
homeassistant    |     if (is_on := self.is_on) is None:
homeassistant    |                  ^^^^^^^^^^
homeassistant    |   File "/config/custom_components/pura/light.py", line 63, in is_on
homeassistant    |     return self._nightlight_data["active"]
homeassistant    |            ^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/config/custom_components/pura/light.py", line 84, in _nightlight_data
homeassistant    |     data = device["schedules"][controller]["nightlight"]
homeassistant    |            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
homeassistant    | IndexError: list index out of range

What version of Home Assistant Core are you running?

core-2024.2.5

What was the last working version of Home Assistant Core?

core-2024.2.5

Diagnostics information

No response

Anything in the logs that might be useful?

No response

Additional information

No response

natekspencer commented 8 months ago

Can you download and post your diagnostic data here as well? It'll help me determine what is available/missing from the endpoint to appropriately work around it.

thenoid commented 8 months ago

I haven't had debugging enabled when HA has generated that error, so wasn't sure if it was useful.

home-assistant_pura_2024-03-02T05-14-26.327Z.log

natekspencer commented 8 months ago

Not the debug logs, but the diagnostics Screenshot_20240301_222820_Home Assistant

thenoid commented 8 months ago

config_entry-pura-b3f5b5fbae3786471d86dca45ea2e5be.json

natekspencer commented 8 months ago

Thank, I think I have a guess as to why. I'm not sure if I'll get to it this weekend but I'll dive in a bit further when I get a chance.