gvigroux / hon

Support of all Haier, Candy, Hoover appliances integrated in the official hOn mobile app. Direct access to all possible services and parameters
MIT License
118 stars 45 forks source link

Error after latest update. #85

Closed MrSleeps closed 1 year ago

MrSleeps commented 1 year ago

On startup I get this error in my logs

Logger: homeassistant.components.sensor
Source: helpers/entity.py:561
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: 19:56:21 (1 occurrences)
Last logged: 19:56:21

Error while setting up hon platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/hon/sensor.py", line 85, in async_setup_entry
    appliances.extend([HonBaseEnd(hass, coordinator, entry, appliance)])
  File "/config/custom_components/hon/sensor.py", line 437, in __init__
    super().__init__(coordinator, appliance, "", "End time")
  File "/config/custom_components/hon/base.py", line 144, in __init__
    self.coordinator_update()
  File "/config/custom_components/hon/sensor.py", line 451, in coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 561, in async_write_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <Entity Tumble dryer End time>

This could be because my Tumble Dryer is currently offline but it needs something to catch the error and update the sensors accordingly..

gvigroux commented 1 year ago

I've did a change. Can you please test ?

gvigroux commented 1 year ago

working now