xiaomi_fan icon indicating copy to clipboard operation
xiaomi_fan copied to clipboard

only one fan detected

Open pasch82-code opened this issue 3 years ago • 5 comments

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

pasch82-code avatar Jul 10 '21 17:07 pasch82-code

Please check your home-assistant.log for errors. The component is able to handle multiple devices in general.

syssi avatar Jul 10 '21 19:07 syssi

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']"

pasch82-code avatar Jul 12 '21 09:07 pasch82-code

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

jimmyhawkin avatar Jul 14 '21 23:07 jimmyhawkin

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.

jimmyhawkin avatar Jul 14 '21 23:07 jimmyhawkin

Thanks for your analysis. This helps to solve the issue.

syssi avatar Jul 15 '21 04:07 syssi