core: Duux Whisper Flex Ultimate fan no longer working in new Tuya integration (`fs`)
The problem
Entity for fan is “unavailable” on the new Tuya integration.
What is version of Home Assistant Core has the issue?
2021.10
What was the last working version of Home Assistant Core?
2021.9
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Tuya
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tuya/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.components.fan
Source: components/tuya/fan.py:211
Integration: Fan (documentation, issues)
First occurred: 09:38:27 (2 occurrences)
Last logged: 09:38:27
Error adding entities for domain fan with platform tuya
Error while setting up tuya platform for fan
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 682, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 491, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 620, in state_attributes
data[ATTR_SPEED] = self.speed
File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 462, in speed
preset_mode = self.preset_mode
File "/usr/src/homeassistant/homeassistant/components/tuya/fan.py", line 211, in preset_mode
return self.tuya_device.status[DPCODE_MODE]
KeyError: 'mode'
Additional information

About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (2 by maintainers)
@frenck this PR solves all fan speed and control issues i am aware of https://github.com/tuya/tuya-home-assistant/pull/490 except for fan direction (forward/reverse)
I’m seeing a similar issue (if not the same) with a Fanco Infinity-ID DC fan:
I tried to get the device info as posted above but couldn’t figure out how to retrieve that. If anyone could post a link or instructions I can provide more details on the device.
@frenck I was able to gather device info using the method from tuya-home-assistant github. Hope this will help. To summarize: this fan was working partially in tuya-home-assistant v1.5 (HACS), and seems to be broken in the same way as of tuya-home-assistant v1.6 (HACS) and the latest Tuya integration (in core).
This is already helpful! If can try again later, that would be great. Otherwise, we have to do it with what is available 😉