home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.61k stars 30.37k forks source link

Tuya commands are sometimes skipped when turning pairs of devices on or off #75226

Closed advicepyro closed 1 year ago

advicepyro commented 2 years ago

The problem

Over the past couple of HA releases, I've noticed after an extended duration of inactivity, if I were to turn on or off (usually on) a pair of Tuya switches or lights either through a HA scene or a HomeKit scene, one of the devices will not receive the command.

In HomeKit, I have a bedroom scene that turns on a switch (with a light plugged in) and a dimmable bulb. Earlier this afternoon I set this scene - one of my lights turned on but the other remained off. Meanwhile HomeKit reports this scene as set and both lights as on.

It's not consistent as to which device does not get an update. In my bedroom example, sometimes it's the switch, while others it's the bulb.

I enabled debug logs for the Tuya integration - below you can see that one device received a response, while the other did not. The other off and on commands done 20 seconds after were because I turned the light on and off in the Tuya Smart Life app.

What version of Home Assistant Core has the issue?

2022.7.4

What was the last working version of Home Assistant Core?

unsure - maybe 2022.4.x?

What type of installation are you running?

Home Assistant Core

Integration causing the issue

tuya

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-07-14 13:39:28 DEBUG (SyncWorker_7) [homeassistant.components.tuya] Sending commands for device eb70ea882b389d79583vph: [{'code': <DPCode.SWITCH_1: 'switch_1'>, 'value': True}]
2022-07-14 13:39:28 DEBUG (SyncWorker_2) [homeassistant.components.tuya] Sending commands for device 40783800bcddc21e486d: [{'code': <DPCode.SWITCH_LED: 'switch_led'>, 'value': True}, {'code': <DPCode.BRIGHT_VALUE: 'bright_value'>, 'value': 255}]
2022-07-14 13:39:29 DEBUG (Thread-9) [homeassistant.components.tuya] Received update for device eb70ea882b389d79583vph: {'switch_1': True, 'countdown_1': 0}
2022-07-14 13:39:49 INFO (MainThread) [pyhap.hap_protocol] ('192.168.1.84', 55103): Connection made to HASS Bridge
2022-07-14 13:39:50 DEBUG (Thread-9) [homeassistant.components.tuya] Received update for device 40783800bcddc21e486d: {'switch_led': True, 'bright_value': 255}
2022-07-14 13:39:51 DEBUG (Thread-9) [homeassistant.components.tuya] Received update for device 40783800bcddc21e486d: {'switch_led': False, 'bright_value': 255}
2022-07-14 13:39:52 DEBUG (Thread-9) [homeassistant.components.tuya] Received update for device 40783800bcddc21e486d: {'switch_led': True, 'bright_value': 255}

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

tuya documentation tuya source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @tuya, @zlinoliver, @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)

kwongrick commented 2 years ago

I have the same issue.

armunro commented 2 years ago

I may have a possible workaround. I've noticed a lot of behavior like that presents like or is essentially diverging states between HASS and Tuya. I don't know enough about either but doing this worked as a general solution:

alias: Reload Tuya
description: ""
trigger:
  - platform: time_pattern
    hours: "*"
    minutes: /5
    seconds: "0"
condition: []
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: 769b8de75416252f68c0267db6f433ed
mode: single

Note: You will need to get the entry_id from the query-string in the URL when viewing devices in the integration.

github-actions[bot] commented 1 year ago

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.