aglehmann / home_assistant_ecovent

Custom component for Home Assistant
27 stars 16 forks source link

Error adding entities for domain fan with platform ecovent #26

Open janegilring opened 1 year ago

janegilring commented 1 year ago

I get the following during Home Assistant startup:

2022-12-20 22:09:51.789 ERROR (MainThread) [homeassistant.components.fan] Error adding entities for domain fan with platform ecovent
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 354, in state_attributes
    data[ATTR_PERCENTAGE] = self.percentage
  File "/config/custom_components/ecovent/fan.py", line 115, in percentage
    return ordered_list_item_to_percentage(ORDERED_NAMED_FAN_SPEEDS, current_speed)
  File "/usr/src/homeassistant/homeassistant/util/percentage.py", line 25, in ordered_list_item_to_percentage
    raise ValueError(f'The item "{item}"" is not in "{ordered_list}"')
ValueError: The item "None"" is not in "['low', 'medium', 'high']"

A similar issue was filed here, could this be relevant?

Lone-Wolf4658 commented 1 year ago

Getting the same error.

janegilring commented 1 year ago

Here is another seemingly working fan integration which might be a reference for what is needed, I suspect there was a breaking change at some point which requires an update to the code.

chuck2k commented 1 year ago

Here is another seemingly working fan integration which might be a reference for what is needed, I suspect there was a breaking change at some point which requires an update to the code.

Could you fix that issue?