Average Sensor is Unavailable due to Get_Instance error in log.
anoril1979 opened this issue · comments
Environment
- Home Assistant Core release with the issue: core-2021.9.7
- This custom component release with the issue: 2.2.3
- Last working this custom component release (if known):
- Operating environment (Home Assistant/Supervisor/Docker/venv): Synology DSM 6.4
Describe the bug
The sensor created using the average platform are displayed "unavailable" all day long.
Configuration.yaml
sensor:
- platform: average
name: "Consommation Glissante Lave Linge"
duration:
minutes: 5
entities:
- sensor.sonoffpowr2_energy_power
Steps to Reproduce
1_ install Average with HACS
2_ restart HA
3_ update configuration yaml
4_ observe :P
Expected behavior
I expect the sensor to be active, displaying a number, whatever it can be. If the number is the average power consuption of a socket for the last 5 minutes, that's brilliant.
Debug log
Logger: homeassistant.helpers.entity
Source: custom_components/average/sensor.py:479
Integration: average ([documentation](https://github.com/Limych/ha-average), [issues](https://github.com/Limych/ha-average/issues))
First occurred: June 20, 2022, 16:24:40 (2101 occurrences)
Last logged: 09:54:44
Update for sensor.consommation_glissante_lave_linge fails
Traceback (most recent call last):
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 446, in async_update_ha_state
await self.async_device_update()
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 641, in async_device_update
raise exc
File "/volume1/@appstore/homeassistant/var/config/custom_components/average/sensor.py", line 301, in async_update
await self._async_update_state()
File "/volume1/@appstore/homeassistant/var/config/custom_components/average/sensor.py", line 479, in _async_update_state
history_list = await get_instance(self.hass).async_add_executor_job(
NameError: name 'get_instance' is not defined
Additional context
Please update HA to the latest version. If the bug remains, please write here.
Arf. OK.
Damit: I'm tied to the package distribution which is not expected to be updated before long. :/
Many thanks anyway.
Paul
Ok. Try to use previous version of this component.
Ha! Clever! Will try this! <3
Works fine with 2.2.0! Many thanks!