xiaomi_fan
xiaomi_fan copied to clipboard
only one fan detected
Home assistant detect only one fan; why?
`fan:
- platform: xiaomi_miio_fan
name: ventilatore_portatile model: zhimi.fan.za5 host: ... token: ... - platform: xiaomi_miio_fan
name: ventilatore model: zhimi.fan.za3 host: ... token: ...`
If I edit config one at a time they both work
Please check your home-assistant.log
for errors. The component is able to handle multiple devices in general.
you're right. so i do not understand
2021-07-12 11:23:16 ERROR (MainThread) [homeassistant.components.fan] Error adding entities for domain fan with platform xiaomi_miio_fan Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 666, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 455, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 607, in state_attributes data[ATTR_SPEED] = self.speed File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 457, in speed percentage = self.percentage File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1157, in percentage return ordered_list_item_to_percentage(FAN_SPEEDS_1C, self._preset_mode) File "/usr/src/homeassistant/homeassistant/util/percentage.py", line 21, in ordered_list_item_to_percentage raise ValueError(f'The item "{item}"" is not in "{ordered_list}"') ValueError: The item "None"" is not in "['Level 1', 'Level 2', 'Level 3']" 2021-07-12 11:23:17 ERROR (MainThread) [homeassistant.components.fan] Error while setting up xiaomi_miio_fan platform for fan Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 258, in _async_setup_platform await asyncio.gather(*pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 666, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 455, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 607, in state_attributes data[ATTR_SPEED] = self.speed File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 457, in speed percentage = self.percentage File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1157, in percentage return ordered_list_item_to_percentage(FAN_SPEEDS_1C, self._preset_mode) File "/usr/src/homeassistant/homeassistant/util/percentage.py", line 21, in ordered_list_item_to_percentage raise ValueError(f'The item "{item}"" is not in "{ordered_list}"') ValueError: The item "None"" is not in "['Level 1', 'Level 2', 'Level 3']"
Have the same problem after the latest update. Then only one fan is detected.
My logg
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 666, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 455, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 607, in state_attributes data[ATTR_SPEED] = self.speed File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 457, in speed percentage = self.percentage File "/config/custom_components/xiaomi_miio_fan/fan.py", line 1157, in percentage return ordered_list_item_to_percentage(FAN_SPEEDS_1C, self._preset_mode) File "/usr/src/homeassistant/homeassistant/util/percentage.py", line 21, in ordered_list_item_to_percentage raise ValueError(f'The item "{item}"" is not in "{ordered_list}"') ValueError: The item "None"" is not in "['Level 1', 'Level 2', 'Level 3']"
MY fan models = zhimi.fan.za5
To me it seems that it acualy might not be a problem with the latest Ha. But with the fan lvl. If you make it have natural mode it has 4 fan speeds. When u put it in this mode it would not add it. If i made it in speed 1-3 it got added.
Thanks for your analysis. This helps to solve the issue.