dotKrad / hass-fpl

FPL Component for Home Assistant
MIT License
40 stars 20 forks source link

Latest commits cause error in DailyUsageSensor #33

Open zoopster opened 2 years ago

zoopster commented 2 years ago

I updated late last week and reset the configuration. It generally works and works well. I'd love to fix these, but they are well over my skill set in python.

in the HASS logs I see the last line in a traceback

File "/config/custom_components/fpl/sensor_DailyUsageSensor.py", line 58, in last_reset date = data[-1]["readTime"] TypeError: 'NoneType' object is not subscriptable

and then just afterwards I get 2022-08-29 08:51:19.306 ERROR (MainThread) [custom_components.fpl] Error fetching fpl data:

But I'm not sure how related they are...

The full set of logs around it... 2022-08-29 08:24:27.554 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session 2022-08-29 08:24:27.555 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connector 2022-08-29 08:31:14.590 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 326, in state_attributes if last_reset := self.last_reset: File "/config/custom_components/fpl/sensor_DailyUsageSensor.py", line 58, in last_reset date = data[-1]["readTime"] TypeError: 'NoneType' object is not subscriptable 2022-08-29 08:39:27.538 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session 2022-08-29 08:39:27.540 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connector 2022-08-29 08:51:19.306 ERROR (MainThread) [custom_components.fpl] Error fetching fpl data: 2022-08-29 08:54:27.629 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session 2022-08-29 08:54:27.631 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connector