markgdev / home-assistant_OctopusAgile

Octopus Agile custom component for Home Assistant
Apache License 2.0
86 stars 33 forks source link

Only some data being filled #98

Closed usbrit closed 1 year ago

usbrit commented 1 year ago

Im having some success getting data, some fields are missing: image

Any suggestions on what might be the cause? Thanks

sjrapid commented 1 year ago

I'm seeing more-or-less the same thing. Current, next and previous are all showing as 'Unknown'. This is on a fresh install of HA2022.10.3

Looking at the logs, I see:

2022-10-12 22:36:05.572 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.octopus_agile_previous_rate fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_device_update raise exc File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/octopusagile/sensor.py", line 88, in update prev_rate = self.hass.states.get("octopusagile.all_rates").attributes.get(rounded_time_str) AttributeError: 'NoneType' object has no attribute 'attributes' 2022-10-12 22:36:05.601 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.octopus_agile_current_rate fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_device_update raise exc File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) File "/config/custom_components/octopusagile/sensor.py", line 159, in update current_rate = self.hass.states.get("octopusagile.all_rates").attributes.get(rounded_time_str) AttributeError: 'NoneType' object has no attribute 'attributes' 2022-10-12 22:36:05.794 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.octopus_agile_next_rate fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_device_update raise exc File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, self.kwargs) File "/config/custom_components/octopusagile/sensor.py", line 227, in update next_rate = self.hass.states.get("octopusagile.all_rates").attributes.get(rounded_time_str) AttributeError: 'NoneType' object has no attribute 'attributes'

Any ideas how to get this working? Many thanks Steve

usbrit commented 1 year ago

Today I got data, but the rates aren't correct: image I have cleared the Gorate fields: image

sjrapid commented 1 year ago

I left an HA instance running all day, and have come back to find the card populated with rates that look correct for region A Screen Capture #103 Not sure why some rates are showing 1 dp and some 2, but it's way better than 'Unknown'...

markgdev commented 1 year ago

This is a known feature, the way in which the rates populate can take a while to get going.