Open deskoh opened 2 years ago
I have this same error for my Tuya lights...
2022-05-15 07:37:54 ERROR (MainThread) [homeassistant.components.light] Error while setting up tuya platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task) File "/usr/src/homeassistant/homeassistant/components/tuya/light.py", line 382, in async_setup_entry async_discover_device([*hass_data.device_manager.device_map]) File "/usr/src/homeassistant/homeassistant/components/tuya/light.py", line 375, in async_discover_device TuyaLightEntity( File "/usr/src/homeassistant/homeassistant/components/tuya/light.py", line 450, in __init__ h_type=IntegerTypeData(dpcode, **function_data["h"]), KeyError: 'h'
I have too the error. Error while setting up tuya platform for fan
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 822, in _async_generate_attributes
attr.update(self.state_attributes or {})
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 357, in state_attributes
data[ATTR_PERCENTAGE] = self.percentage
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/fan.py", line 253, in percentage
return ordered_list_item_to_percentage(self._speeds.range, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 "silent" is not in "['low', 'high']"
FWIW is submitted a ticket with tuya developer platform.
https://service.console.tuya.com/8/3/detail?id=T202407190203
I switched to the below version of Local Tuya and everything is now working. It seems to be a more recent and up-to-date maintained version.
Describe the bug
The reported fan speed and fan speed enum have different data types.
See home-assistant/core#70573.
Expected behavior
A clear and concise description of what you expected to happen.
Fan speed enum from Tuya API/Cloud response should be integer:
Diagnostics for integrations and devices