core icon indicating copy to clipboard operation
core copied to clipboard

Tuya dimmer switch cannot change brightness, only on/off

Open jad889nb opened this issue 4 years ago • 14 comments

The problem

Tuya dimmer switches not getting brightness command from Home Assistant. product Category is "tgq". I have 2 types of this dimmer, and one type works and the other does not. Suspect related to a differenece in: Working tgq instruction set:

switch_led_1 | Boolean | "{true,false}"
-- | -- | --
bright_value_1 | Integer | {   "unit": "",   "min": 10,   "max": 1000,   "scale": 0,   "step": 1 }

Non working set:

switch_led | Boolean | "{true,false}"
-- | -- | --
bright_value_v2 | Integer | {   "min": 10,   "scale": 0,   "unit": "",   "max": 1000,   "step": 1 }

One uses bright value 1 and the other bright value 2. These are the same brand... working unit "Smart 3-Way Dimmer Switch_DS02_NEW", non working unit "DS02S Smart dimmer switch"

HA is not sending any brightness command information to these devices... brightness control works well in native app.

Logs and debug info below.

What version of Home Assistant Core has the issue?

2021.11.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

tuya

Link to integration documentation on our website

No response

Example YAML snippet

N/A

Anything in the logs that might be useful for us?

2021-11-28 08:02:11 DEBUG (SyncWorker_4) [homeassistant.components.tuya.base] Sending commands for device 8240074324a1603a1e8e: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}]
2021-11-28 08:02:13 DEBUG (Thread-5) [homeassistant.components.tuya] Received update for device 8240074324a1603a1e8e: {'switch_led': True, 'bright_value_v2': 100}


THIS COMMAND EXECUTED VIA SERVICE CALL TO LIGHT_ON... SAME RESULTS
2021-11-28 08:04:11 DEBUG (SyncWorker_5) [homeassistant.components.tuya.base] Sending commands for device 8240074324a1603a1e8e: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}]
2021-11-28 08:04:11 DEBUG (Thread-5) [homeassistant.components.tuya] Received update for device 8240074324a1603a1e8e: {'switch_led': True, 'bright_value_v2': 100}


THIS IS A COMMAND TO THE WORKING SWITCH FOR THE SAME ACTION:
2021-11-28 08:07:41 DEBUG (SyncWorker_0) [homeassistant.components.tuya.base] Sending commands for device 22002172e0980605bf33: [{'code': <DPCode.SWITCH_LED_1: 'switch_led_1'>, 'value': True}, {'code': <DPCode.BRIGHT_VALUE_1: 'bright_value_1'>, 'value': 445}]
2021-11-28 08:07:41 DEBUG (Thread-5) [homeassistant.components.tuya] Received update for device 22002172e0980605bf33: {'switch_led_1': True, 'bright_value_1': 445, 'brightness_min_1': 100, 'led_type_1': 'incandescent'}

Additional information

This Unit Works Correctly:

Product Name: Smart 3-Way Dimmer Switch_DS02_NEW Product Category: tgq

Code	Type	Values
switch_led_1	Boolean	"{true,false}"
bright_value_1	Integer	{
  "unit": "",
  "min": 10,
  "max": 1000,
  "scale": 0,
  "step": 1
}
brightness_min_1	Integer	{
  "unit": "",
  "min": 10,
  "max": 1000,
  "scale": 0,
  "step": 1
}
led_type_1	Enum	{
  "range": [
    "incandescent",
    "halogen"
  ]
}

This is the non working model:

Product Name: DS02S Smart dimmer switch Product Category: tgq

Code	Type	Values
switch_led	Boolean	"{true,false}"
bright_value_v2	Integer	{
  "min": 10,
  "scale": 0,
  "unit": "",
  "max": 1000,
  "step": 1
}

HA is not sending any brightness command to the non working unit. I cannot find any further log information related to the problem, no errors or other messages that trace back to this.

jad889nb avatar Nov 28 '21 16:11 jad889nb

Hey there @tuya, @zlinoliver, @metisu, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

I have this problem too. It worked just before the recent status delay/lost issue. With on/off starting to work again yestrerday, brightness was lost. It works using the Tuya Smart app but not using HA.

I have latest HA and recently restarted the entire host.

Product name: WIFI Dimmer module Product Category: dj

EDIT: I have since quit everything Tuya.

svante-jacobsen avatar Nov 30 '21 07:11 svante-jacobsen

I am still not able to do any dimming as well.

This is still the same issue as I had reported in the past: https://github.com/home-assistant/core/pull/60385 https://github.com/home-assistant/core/issues/59167

Turning on the light:

2021-12-17 10:19:55 DEBUG (SyncWorker_9) [homeassistant.components.tuya.base] Sending commands for device 34142186f4cfa201671b: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}] 2021-12-17 10:19:55 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 34142186f4cfa201671b: {'switch_led': True, 'bright_value': 255}

Trying to set brightness:

2021-12-17 10:20:02 DEBUG (SyncWorker_0) [homeassistant.components.tuya.base] Sending commands for device 34142186f4cfa201671b: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}, {'code': <DPCode.BRIGHT_VALUE: 'bright_value'>, 'value': 64}]

Turning off the light:

2021-12-17 10:20:30 DEBUG (SyncWorker_3) [homeassistant.components.tuya.base] Sending commands for device 34142186f4cfa201671b: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': False}] 2021-12-17 10:20:30 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 34142186f4cfa201671b: {'switch_led': False, 'bright_value': 255}

Quinniedid avatar Dec 17 '21 17:12 Quinniedid

Yesterday, Home Assistant 2022.2 was released. Could you try upgrading to that version and see if the issue has been resolved?

If not, Home Assistant 2022.2 contains a new diagnostic tool. There is now a "Download Diagnostics" button on each Tuya device on the device page. Clicking that button will download diagnostics information for that specific device. Drag the downloaded file into this issue. It will help with finding out what the problem is.

frenck avatar Feb 03 '22 14:02 frenck

@frenck I have been unable to change the brightness from the API dashboard and I submitted a ticket to Tuya. They instructed me to download Postman and the API packages and I was able to change my brightness from that... So I am not sure if they are just not wanting to fix the issue or there is still an issue with HA.

I have attached all 5 of my dimmer switches diagnostic logs tuya-a9fda3475346c48fee6d74e6637262ba-Office Light-1ea3a67d081118bd0357add70170ff7c.json.txt tuya-a9fda3475346c48fee6d74e6637262ba-Bedroom Light-7eaab52e6b08f4e43dc4289aaeceb710.json.txt tuya-a9fda3475346c48fee6d74e6637262ba-Master Light-a7d01875d6ee249ccaf83d6cf3de850f.json.txt tuya-a9fda3475346c48fee6d74e6637262ba-Living Room Light-892630eb79bd775351a03a846876545a.json.txt tuya-a9fda3475346c48fee6d74e6637262ba-Dining Room Light-54b67e823c9199e8078222a4b35a699f.json.txt

Quinniedid avatar Feb 07 '22 15:02 Quinniedid

I have the same problem with Makegood (iSwitch OZ) Tuya based dimmer switches. Here are two examples: tuya-593479a6fbd8d617c56fef36aad34a81-Kitchen Island-fa221032f27f44c337bfa2125fde15d5.json (1).txt tuya-593479a6fbd8d617c56fef36aad34a81-Skyball-f2bebfd911714da2e2735a8743a985cf.json.txt

When using the brightness the lights just blink (like they are being turned off and on quickly) no matter what brightness I set them too.

Smartdrive78 avatar Apr 21 '22 01:04 Smartdrive78

After playing around for a while I realised that the dimmer is actually dimming, however it only reacts to values in HA between 0-33% - anything higher does not get regarded.

Looking at the IOT Tuya platform (and in the SmartLife app) I can see that I can set the dimmer only to values between 0-100 thought the dimmer range is defined as 25-255

and when I dim in HA using a value between 0-33% it always flashes and then dims down. Whereas when using smart life for example it properly dims up/down

I wonder now:

  1. Can I change the range on the actual dimmer to reflect 0-100
  2. Or can I tell HA to re-adjust the dimmer range on the controls to reflect what my dimmer is doing and also dim properly?

Smartdrive78 avatar May 06 '22 06:05 Smartdrive78

I am experiencing the "on/off works, but brightess doesn't" on my Gosund SW-2 dimmers. Tuya category "dj"

The following behavior is consistent on both of the following dimmers:

Device Information:
Product Name: SW2智能调光开关-AR
Device ID: [REDACTED]
Product Category: dj
Main Module: v1.0.3
MCU Module: v1.0.3
Device Information:
Product Name: SW2智能调光开关
Device ID: [REDACTED]
Product Category: dj
Main Module: v1.0.1
MCU Module: v1.0.1

On this version of HA:

Home Assistant 2022.7.3
Frontend 20220707.0 - latest

When debugging using the Tuya IoT platform to send instructions directly to the dimmers, I have noticed that when sending instructions containing BOTH switch_led & bright_value at the same time, the bright_value gets ignored.

For example, with the switch OFF, and the last bright_value @ 255, sending:

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

Will only turn the switch ON.

Once the switch is ON, sending the same instructions does not change the brightness at all (bright_value still at 255)

HOWEVER, once the switch is on, if you send JUST the bright_value, it is respected and the light dims.

E.g. - sending:

[
  {
    "code": "bright_value",
    "value": 115
  }
]

adjusts the brightess as expected.

I have noticed that the HA never sends two separate messages (e.g. one for power, the other for brightness) - instead, it looks like both are always sent at once (and in my case, the brightness value is ignored by the dimmer switch)

e.g. - turning the switch ON using HA look like this in the debug logs:

2022-07-20 16:21:25 DEBUG (SyncWorker_6) [tuya_iot] Request: method = POST,url =https://openapi.tuyaus.com/v1.0/devices/[REDACTED]/commands,params = None, body = {'commands': [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}]}, t=1658334085801

changing the brightness (which doesn't change the brightness) looks like this:

2022-07-20 16:23:30 DEBUG (SyncWorker_9) [tuya_iot] Request: method = POST,url = https://openapi.tuyaus.com/v1.0/devices/[REDACTED]/commands,params = None,body = {'commands': [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}, {'code': <DPCode.BRIGHT_VALUE: 'bright_value'>, 'value': 131}]},t = 1658334210881

I believe that if HA was to send distinct instructions/API requests to Tuya for dimming & power, then adjusting the brightness would work.

E.g.: When turning ON in HA:

  1. Send instruction for switch_led: true
  2. Send instruction for bright_value: [HA value]

When changing brightness in HA:

  1. Only send instruction for bright_value: [HA value]

When turning OFF in ha:

  1. Send instruction for switch_led: false

Note that sending bright_value when the switch is OFF appears to be ignored, as well.

I'm new to HA & these switches, so cannot comment on whether this has ever worked before, and/or what might have changed over time to change the behaviour.

lukeskis avatar Jul 20 '22 16:07 lukeskis

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

This is still an issue as of HA 2023.1

Quinniedid avatar Jan 14 '23 15:01 Quinniedid

Still an open issue.

waseltzer avatar Mar 03 '23 00:03 waseltzer

I just installed a 1-CH Dimmer Module WIFI and it doesn't come up as a light, let alone like a dimmer. Not good, especially as it took me 2 hours to deinstall an old "less smart" dimmer and install this one (in the ceiling, nice) and then to find out that HA doesn't recoginize it as a dimmer. It shows 2 entities:

  • Power on behaviour (0, 1 or 2, mine is set to 2)
  • Indicator light mode, which is greyed out (doesn't work)

NLRoger avatar Mar 07 '23 16:03 NLRoger

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still an open issue. I'd be glad to help work on a solution, but haven't developed any HA integrations yet. Anyone want to work together on this?

waseltzer avatar Jun 05 '23 17:06 waseltzer

This is still an issue for me in the latest build. I have a couple of these that won't change brightness and a couple that will. They are all gosund brand but I'm using the tuya smart app to control them. The ones that work show the main/mcu module as v1.0.4 and have a brightness slider in the tuya app. The two that the brightness doesn't work in ha have the main/mcu module as v1.0.3. They don't show the brightness slider in the tuya app until you turn them on and click on the "white" button in the app tab at the bottom which then brings up a silder. From there I am able to adjust brightness on the mobile app. There's not firmware updates for these.

jaayb avatar Jul 25 '23 17:07 jaayb

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still an open issue for me...

waseltzer avatar Oct 30 '23 19:10 waseltzer

Same here. I keep trying as new updates come out but there's been no change on the tuya devices.

jaayb avatar Oct 30 '23 19:10 jaayb