Request support for Tuya Humidifier/Aroma Diffuser GD2050WIFI
Log message
Device matches etersky_aroma_diffuser with quality of 100%. DPS: {"updated_at": 1765614728.125988, "1": true, "2": true, "3": "large", "4": "2h", "5": 0, "7": true, "8": 100, "9": "colourful1", "10": "000000000000", "11": 0}
This error originated from a custom integration.
Logger: homeassistant
Source: custom_components/tuya_local/light.py:185
integration: Tuya Local (documentation, issues)
First occurred: 19:21:07 (247 occurrences)
Last logged: 21:23:01
Error doing job: Exception in callback Entity._async_write_ha_state_from_call_soon_threadsafe() (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _async_write_ha_state_from_call_soon_threadsafe
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1149, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1088, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1286, in state_attributes
data[ATTR_BRIGHTNESS] = self.brightness
^^^^^^^^^^^^^^^
File "/config/custom_components/tuya_local/light.py", line 166, in brightness
return self._hsv_brightness
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tuya_local/light.py", line 214, in _hsv_brightness
rgbhsv = self._unpacked_rgbhsv
^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tuya_local/light.py", line 185, in _unpacked_rgbhsv
vals = unpack(fmt.get("format"), color)
struct.error: unpack requires a buffer of 7 bytes
Product ID
sf6rbebwtwdsk0za
Product Name
Tuya Humidifier/Aroma diffuser
DPS information
{
"result": {
"model": "{\"modelId\":\"dwzcgo\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"1029\"},\"name\":\"总开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"switch_spray\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"1029\"},\"name\":\"喷雾开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"mode\",\"description\":\"【喷雾模式、喷雾档位二选一】【适配语音功能】支持高中低挡喷雾量\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1028\"},\"name\":\"工作模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"large\",\"middle\"]}},
{\"abilityId\":4,\"accessMode\":\"rw\",\"code\":\"countdown_set\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"1028\"},\"name\":\"倒计时\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"2h\",\"4\",\"Long\",\"intermittence\"]}},
{\"abilityId\":5,\"accessMode\":\"ro\",\"code\":\"countdown_left\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"1024\"},\"name\":\"喷雾倒计时剩余时间\",\"typeSpec\":{\"type\":\"value\",\"max\":360,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"min\"}},
{\"abilityId\":7,\"accessMode\":\"rw\",\"code\":\"switch_led\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"1025\"},\"name\":\"灯光\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":8,\"accessMode\":\"rw\",\"code\":\"bright_value\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-liangdu\",\"attribute\":\"1024\"},\"name\":\"亮度值\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":1,\"scale\":0,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":9,\"accessMode\":\"rw\",\"code\":\"work_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1024\"},\"name\":\"灯光模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"white\",\"colour\",\"colourful1\"]}},
{\"abilityId\":10,\"accessMode\":\"rw\",\"code\":\"colour_data\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1024\"},\"name\":\"彩光值\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":11,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\",\"attribute\":\"1024\"},\"name\":\"故障告警\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"lack_water\"],\"maxlen\":1}}]}]}"
},
"success": true,
"t": [1765567782850](tel:1765567782850),
"tid": "e8b2a5ddd79011f0907cf2f713bbc069"
}
{
"result": {
"properties": [
{
"code": "switch",
"custom_name": "",
"dp_id": 1,
"time": 1765567033400,
"type": "bool",
"value": true
},
{
"code": "switch_spray",
"custom_name": "",
"dp_id": 2,
"time": 1765567028718,
"type": "bool",
"value": true
},
{
"code": "mode",
"custom_name": "",
"dp_id": 3,
"time": 1765567028899,
"type": "enum",
"value": "large"
},
{
"code": "countdown_set",
"custom_name": "",
"dp_id": 4,
"time": 1765554209139,
"type": "enum",
"value": "2h"
},
{
"code": "countdown_left",
"custom_name": "",
"dp_id": 5,
"time": 1765554209139,
"type": "value",
"value": 0
},
{
"code": "switch_led",
"custom_name": "",
"dp_id": 7,
"time": 1765567165303,
"type": "bool",
"value": true
},
{
"code": "bright_value",
"custom_name": "",
"dp_id": 8,
"time": 1765566575983,
"type": "value",
"value": 100
},
{
"code": "work_mode",
"custom_name": "",
"dp_id": 9,
"time": 1765566575898,
"type": "enum",
"value": "colourful1"
},
{
"code": "colour_data",
"custom_name": "",
"dp_id": 10,
"time": 1765556817568,
"type": "string",
"value": "0000000003e8"
},
{
"code": "fault",
"custom_name": "",
"dp_id": 11,
"time": 1765554209139,
"type": "bitmap",
"value": 0
}
]
},
"success": true,
"t": 1765567322375,
"tid": "d63c7eafd78f11f091dbb67f4af8076d"
}
Information about how the device functions
Hi dev,
I bought a generic Tuya Humidifier from AliExpress, but not all features are working as intended. When trying to turn on the build in light i am getting some strange error for buffer size.
Could you please take a look and if possible to add full support for the device.
Thank you!
{
"result": {
"model": "{\"modelId\":\"dwzcgo\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"1029\"},\"name\":\"总开关\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"switch_spray\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"1029\"},\"name\":\"喷雾开关\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"mode\",\"description\":\"【喷雾模式、喷雾档位二选一】【适配语音功能】支持高中低挡喷雾量\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1028\"},\"name\":\"工作模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"large\",\"middle\"]}},{\"abilityId\":4,\"accessMode\":\"rw\",\"code\":\"countdown_set\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"1028\"},\"name\":\"倒计时\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"2h\",\"4\",\"Long\",\"intermittence\"]}},{\"abilityId\":5,\"accessMode\":\"ro\",\"code\":\"countdown_left\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"1024\"},\"name\":\"喷雾倒计时剩余时间\",\"typeSpec\":{\"type\":\"value\",\"max\":360,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"min\"}},{\"abilityId\":7,\"accessMode\":\"rw\",\"code\":\"switch_led\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"1025\"},\"name\":\"灯光\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":8,\"accessMode\":\"rw\",\"code\":\"bright_value\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-liangdu\",\"attribute\":\"1024\"},\"name\":\"亮度值\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":1,\"scale\":0,\"step\":1,\"unit\":\"\"}},{\"abilityId\":9,\"accessMode\":\"rw\",\"code\":\"work_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1024\"},\"name\":\"灯光模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"white\",\"colour\",\"colourful1\"]}},{\"abilityId\":10,\"accessMode\":\"rw\",\"code\":\"colour_data\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1024\"},\"name\":\"彩光值\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},{\"abilityId\":11,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\",\"attribute\":\"1024\"},\"name\":\"故障告警\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"lack_water\"],\"maxlen\":1}}]}]}"
},
"success": true,
"t": [1765567782850](tel:1765567782850),
"tid": "e8b2a5ddd79011f0907cf2f713bbc069"
}
Here’s some more log from the HA
Logger: homeassistant.components.light
Source: helpers/entity_platform.py:676
integration: Light (documentation, issues)
First occurred: 19:19:09 (3 occurrences)
Last logged: 20:12:18
Error adding entity light.humidifier_nightlight for domain light with platform tuya_local
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 676, in _async_add_entities
await self._async_add_entity(
entity, False, entity_registry, config_subentry_id
)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1002, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1380, in add_to_platform_finish
self.async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1024, in async_write_ha_state
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1149, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1088, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1286, in state_attributes
data[ATTR_BRIGHTNESS] = self.brightness
^^^^^^^^^^^^^^^
File "/config/custom_components/tuya_local/light.py", line 166, in brightness
return self._hsv_brightness
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tuya_local/light.py", line 214, in _hsv_brightness
rgbhsv = self._unpacked_rgbhsv
^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tuya_local/light.py", line 185, in _unpacked_rgbhsv
vals = unpack(fmt.get("format"), color)
struct.error: unpack requires a buffer of 7 bytes
I decided to give it a try to make the config based on the other humidifiers and some ChatGPT. A few tries later and after some debugging, here’s fully working config, matching 1:1 all command with the Tuya app and the light is working properly.
name: Aroma Diffuser DWZCGO
products:
- id: sf6rbebwtwdsk0za
manufacturer: Generic
entities:
- entity: fan
translation_key: aroma_diffuser
dps:
- id: 2
name: switch
type: boolean
- id: 3
name: speed
type: string
mapping:
- dps_val: large
value: 100
- dps_val: middle
value: 50
- id: 4
name: preset_mode
type: string
mapping:
- dps_val: "2h"
value: "Continuous"
- dps_val: "4"
value: "Interval"
- dps_val: "Long"
value: "2h"
- dps_val: "intermittence"
value: "4h"
- entity: switch
name: Power
class: switch
category: config
dps:
- id: 1
name: switch
type: boolean
- entity: light
translation_key: nightlight
dps:
- id: 7
name: switch
type: boolean
- id: 8
name: brightness
type: integer
optional: true
range:
min: 1
max: 100
- id: 9
name: color_mode
type: string
mapping:
- dps_val: white
value: white
- dps_val: colour
value: hs
- dps_val: colourful1
value: effect
- id: 10
name: rgbhsv
type: hex
optional: true
format:
- name: h
bytes: 2
range:
min: 0
max: 360
- name: s
bytes: 1
range:
min: 0
max: 255
- name: v
bytes: 1
range:
min: 0
max: 255
- name: w
bytes: 2
optional: true
- entity: sensor
translation_key: time_remaining
class: duration
category: diagnostic
dps:
- id: 5
type: integer
name: sensor
unit: min
- entity: binary_sensor
class: problem
category: diagnostic
dps:
- id: 11
type: bitfield
name: sensor
mapping:
- dps_val: 0
value: false
- value: true
- id: 11
name: fault_code
type: bitfield
These log messages appear related to using an incorrect config with the device. They do not show the local dps that are needed to evaluate all the rest of the information supplied.
Hi, when I try to add it without my custom config, it matches with some kind of Aroma diffuser (show in log below), but it's not working correctly show with the logs from my previous comments, because the light entity in the matched config is using different color coding scheme (7 bytes) compared to the one that this device uses (6 bytes). In the config that I shared this issue is fixed and also included the preset modes as part of the fan entity itself.
This error originated from a custom integration.
Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:433
integration: Tuya Local (documentation, issues)
First occurred: 10:32:13 (1 occurrence)
Last logged: 10:32:13
Device matches etersky_aroma_diffuser with quality of 100%. DPS: {"updated_at": 1765614728.125988, "1": true, "2": true, "3": "large", "4": "2h", "5": 0, "7": true, "8": 100, "9": "colourful1", "10": "000000000000", "11": 0}