Closed Jilas closed 1 year ago
I've issued a new release with some more checks around the code that your logs highlighted. Please let me know if this has got you further.
I've issued a new release with some more checks around the code that your logs highlighted. Please let me know if this has got you further.
Thanks for getting that out so quickly.
So just straight update on the test system, I gained some but not all of the sensors. So I deleted and started that again (with 7.1.1, and can confirm I was missing/not getting created.
For both gas and electric ....previous_accumulative_consumption ....previous_accumulative_cost
And gas only ....previous_accumulative_consumption_kwh
Would be useful to have those even if they are left as zero or unavailable, as was how I was checking if the meter was smart or dumb.
Nothing has changed between releases that determine if those sensors should/should not appear. The presense of these sensors is determined by the data returned by OE that indicates if you have a smart meter. If OE has changed this in your account, then this would account for this.
I've had a few reports recently of this data missing, so I'll look at including the sensors in a disabled state in the future if OE are not reporting as a "smart sensor" so that people can make their own judgement for enabling the sensors.
Are you seeing any other errors that might indicate any other issues?
Thats odd. A fresh install of 7.0.0 gives the 16 sensors. Vs 7.1.1 that drops those 5 as listed.
Checking the logs I do get this, does that help?
Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:371
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 3:39:08 PM (2 occurrences)
Last logged: 3:59:22 PM
Entity sensor.octopus_energy_electricity_xxxx_xxxx_current_demand (<class 'custom_components.octopus_energy.electricity.current_demand.OctopusEnergyCurrentElectricityDemand'>) with state_class measurement has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author.
I had a look into the debug logs (vs the main logs which above doesn't help). I think this is the bit you might be after.
2023-05-11 15:38:24.400 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs 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 2023-05-11 15:38:24.405 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration octopus_energy 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 2023-05-11 15:38:56.405 WARNING (MainThread) [homeassistant.setup] Setup of input_boolean is taking over 10 seconds. 2023-05-11 15:38:59.162 ERROR (MainThread) [homeassistant.components.mqtt.client] Failed to connect to MQTT server due to exception: [Errno -2] Name does not resolve 2023-05-11 15:39:07.989 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_consumption.py", line 90, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.039 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_consumption_peak.py", line 96, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.046 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_consumption_off_peak.py", line 96, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.054 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_cost.py", line 86, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.062 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_cost_peak.py", line 92, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.071 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_cost_off_peak.py", line 92, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.088 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/gas/previous_accumulative_consumption.py", line 90, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.096 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/gas/previous_accumulative_consumption_kwh.py", line 90, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.104 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/gas/previous_accumulative_cost.py", line 91, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:39:08.155 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.octopus_energy_electricity_XXXX_XXXX_current_demand (<class 'custom_components.octopus_energy.electricity.current_demand.OctopusEnergyCurrentElectricityDemand'>) with state_class measurement has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author. 2023-05-11 15:59:19.114 WARNING (MainThread) [custom_components.octopus_energy.coordinators.saving_sessions] Debouncer call ignored as shutdown has been requested. 2023-05-11 15:59:22.262 WARNING (MainThread) [custom_components.octopus_energy.coordinators.saving_sessions] Debouncer call ignored as shutdown has been requested. 2023-05-11 15:59:22.270 WARNING (MainThread) [custom_components.octopus_energy.coordinators.electricity_rates] Debouncer call ignored as shutdown has been requested. 2023-05-11 15:59:22.279 WARNING (MainThread) [custom_components.octopus_energy.coordinators.electricity_rates] Debouncer call ignored as shutdown has been requested. 2023-05-11 15:59:22.296 WARNING (MainThread) [custom_components.octopus_energy.coordinators.electricity_rates] Debouncer call ignored as shutdown has been requested. 2023-05-11 15:59:22.309 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_consumption.py", line 90, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.318 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_consumption_peak.py", line 96, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.324 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_consumption_off_peak.py", line 96, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.330 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_cost.py", line 86, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.336 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_cost_peak.py", line 92, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.343 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/electricity/previous_accumulative_cost_off_peak.py", line 92, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.363 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/gas/previous_accumulative_consumption.py", line 90, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.374 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/gas/previous_accumulative_consumption_kwh.py", line 90, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.381 ERROR (MainThread) [homeassistant.components.sensor] octopus_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update await coro File "/config/custom_components/octopus_energy/gas/previous_accumulative_cost.py", line 91, in async_update consumption_data = self.coordinator.data["consumption"] if "consumption" in self.coordinator.data else None TypeError: argument of type 'NoneType' is not iterable 2023-05-11 15:59:22.429 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.octopus_energy_electricity_XXXX_XXXX_current_demand (<class 'custom_components.octopus_energy.electricity.current_demand.OctopusEnergyCurrentElectricityDemand'>) with state_class measurement has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author.
Yup I think that's given me a better clue to the issue. I'll try and prepare another fix as soon as possible.
That picked up the missing entities after an upgrade from 7.1.1 to 7.1.2b1, and it did give 4 extra (disabled) ones, which I'd not had before.
Given some people might, and if the data from Octopus is unclear, makes sense to offer them like that.
So I pulled the debug log just for completeness, in case the error thats there is one you are concerned by ( I can run a longer log if needed).
2023-05-11 17:05:22.019 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.octopus_energy_electricity_xxxx_xxxx_current_demand (<class 'custom_components.octopus_energy.electricity.current_demand.OctopusEnergyCurrentElectricityDemand'>) with state_class measurement has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author. 2023-05-11 17:08:04.255 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Account for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 169, in async_setup_entry return await component.async_setup_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 179, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2023-05-11 17:08:06.412 WARNING (MainThread) [custom_components.octopus_energy.coordinators.saving_sessions] Debouncer call ignored as shutdown has been requested. 2023-05-11 17:08:06.422 WARNING (MainThread) [custom_components.octopus_energy.coordinators.electricity_rates] Debouncer call ignored as shutdown has been requested. 2023-05-11 17:08:06.426 WARNING (MainThread) [custom_components.octopus_energy.coordinators.electricity_rates] Debouncer call ignored as shutdown has been requested. 2023-05-11 17:08:06.433 WARNING (MainThread) [custom_components.octopus_energy.coordinators.electricity_rates] Debouncer call ignored as shutdown has been requested. 2023-05-11 17:08:06.488 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.octopus_energy_electricity_xxxx_xxxx_current_demand (<class 'custom_components.octopus_energy.electricity.current_demand.OctopusEnergyCurrentElectricityDemand'>) with state_class measurement has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author.
Glad that's worked for you. I'll kick off a proper release.
Those new sensors are available and disabled as part of this feature update as they don't apply to all tariffs. Like mentioned (and I think you're agreeing), I'll probably adopt this method for the consumption sensors when OE thinks the meters aren't smart.
That error I've seen a couple of times, but can't track down what's causing it. I'm not sure if it's a race condition within HA itself.
Are you happy for me to close this issue?
Totally agree on the disabled sensors. Glad that's a known "unknown" but not service affecting feature.
So yes more than happy to close this problem. Many thanks for reacting so quickly to it and in general for the whole integration.
All much appreciated.
PS I saw this update was to fix the gas costs in the energy panel, that also works for me. So thanks again!
Describe the bug
Updated from version 7.0.0 to v.7.10, all sensors (apart from the Octopus savings sessions binary) became unavailable. Meters are currently dumb and not sending data to the DCC but have a working Mini on the account.
To Reproduce Currently the smart meters have an error, and have stopped sending data to the DCC around Feb '23 (waiting for a site visit to power cycle them!!). There is a working Octopus Mini on the account that is sending data.
In the above state, installing v7.1.0 of integration from fresh just creates "binary_sensor.octopus_energy_saving_sessions". If then downgrade to v7.0.0 then that creates all of the meter sensors as expected, pulls data that is available is presented. If upgraded as soon as the v7.1.0 finishes starting up all but the saving sessions become unavailable.
This was reproduced on a second minimum "test" instance and happy to help with any testing.
Expected behavior
That sensors are available/created, but just left unavailable, and for those that do work like the Mini's data, continues to work when meters become dumb.
There might be an interesting feature here, to show, for each meter, when there is a smart meter failure, so it can be raised with Octopus to get it sorted out.
Home Assistant Version
The version of Home Assistant. - 2023.5.2
Integration Version
7.1.0
Fresh Install?
Both fresh and existing installs as above.
Home Assistant Logs
Just pulled from the current logs, the following (removed my meter details and changed them to xxxx_xxxx):