core: Tuya Gosund Dimmer switch brightness not able to change

The problem

I am unable to set the brightness on my Gosund Tuya dimmer switches. I can see the value change in HA when I set it outside of HA, but unable to change brightness in HA

What version of Home Assistant Core has the issue?

core-2021.11.1

What was the last working version of Home Assistant Core?

core-2021.9.7

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?

No response

Additional information

Product Name: SW2智能调光开关 Product Category: dj

JSON:

[
  {
    "code": "switch_led",
    "value": true
  },
  {
    "code": "bright_value",
    "value": 25
  }
]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Ok, thanks! That look like a bug indeed! Thanks for all the extensive information on this, that helps a lot!

I can confirm that this issue is still present on the latest HA 2021.11.5 update

Same issue here, my Gosund devices - Product Category tgq in Tuya work fine. My other Devices (CE smart home - Product Category dj in tuya) do not dim and act only as a switch. Let me know if I can provide any other info to help.

Same here, this issue is still present, seem not to be able to dim any devices with a product category of DJ. I have 3 dimmer switches that fall into this category. I am able to di them with the tuya app, but not through hassio Version core-2021.11.5

That was trying to change the brightness.

Turning light off:

2021-11-06 23:31:30 DEBUG (SyncWorker_0) [homeassistant.components.tuya.base] Sending commands for device 34142186f4cfa201671b: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': False}]
2021-11-06 23:31:31 DEBUG (Thread-32) [homeassistant.components.tuya] Received update for device 34142186f4cfa201671b: {'switch_led': False, 'bright_value': 255}

Turning light on:

2021-11-06 23:31:34 DEBUG (SyncWorker_3) [homeassistant.components.tuya.base] Sending commands for device 34142186f4cfa201671b: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}]
2021-11-06 23:31:34 DEBUG (Thread-32) [homeassistant.components.tuya] Received update for device 34142186f4cfa201671b: {'switch_led': True, 'bright_value': 255}

Trying to change brightness on light:

2021-11-06 23:31:40 DEBUG (SyncWorker_1) [homeassistant.components.tuya.base] Sending commands for device 34142186f4cfa201671b: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}]
2021-11-06 23:31:41 DEBUG (Thread-32) [homeassistant.components.tuya] Received update for device 34142186f4cfa201671b: {'switch_led': True, 'bright_value': 255}

Having the same issue, looks like the Tuya integration thinks that simple dimmers support color (color_mode is ‘hs’ instead of ‘brightness’) and, as a result, setting the brightness goes down the wrong path and ends up not setting anything.

This is probably a one-line code fix somewhere inside https://github.com/home-assistant/core/blob/79d6d795578670bf1bb387af165383532355994b/homeassistant/components/tuya/light.py#L649

I can confirm this is still an issue on 2021.11.5 for dimmers with product category ‘tgq’ (DS02 Smart dimmer switch)

Same for me too. The issue is still there with 2021.11.5.