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
73.31k stars 30.62k forks source link

Tuya integration not reflecting sensor state #124975

Open jamesgeddes opened 2 months ago

jamesgeddes commented 2 months ago

The problem

Tuya integration is not accurately discerning sensor state. Please see demonstration.

https://youtu.be/UbQEa_1kQio?si=XerIEcIl_AsG57Nc

Issue Summary:

When the state of a sensor changes in the Tuya Smart Life app, this change is not reflected in Home Assistant. For example, if a door sensor shows as "open" in the Tuya Smart Life app, Home Assistant still shows the sensor as "closed" or does not update the state accordingly.

Steps to Reproduce:

  1. Set up a door sensor (or similar device) in the Tuya Smart Life app.
  2. Integrate this sensor with Home Assistant using the Tuya integration.
  3. Physically open the door and observe the sensor's state change in the Tuya app (e.g., from "closed" to "open").
  4. Check the state of the same sensor in Home Assistant.

Expected Behaviour:

The sensor state in Home Assistant should match the state shown in the Tuya app. For example, when the door is physically opened and the Tuya app shows the door as "open," Home Assistant should also display the sensor as "open."

Actual Behaviour:

The sensor state in Home Assistant does not update to reflect the change. For instance, even if the door is open and the Tuya app correctly shows it as "open," Home Assistant may still show the sensor as "closed" or not update the state at all.

This issue makes it challenging to rely on Home Assistant for accurate real-time monitoring and automation based on sensor states.

What version of Home Assistant Core has the issue?

Core 2024.7.4

Supervisor 2024.08.0

Operating System 12.3

Frontend 20240710.0

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

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?

No response

Additional information

No response

home-assistant[bot] commented 2 months 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!

Code owner commands Code owners of `tuya` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tuya` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

mib1185 commented 2 months ago

Hi @jamesgeddes could you please write a short summarized description of your issue? I think this would be more helpful, than watching a ~4 minute video :wink: thx :+1:

jamesgeddes commented 2 months ago

Hi @jamesgeddes could you please write a short summarized description of your issue? I think this would be more helpful, than watching a ~4 minute video :wink: thx :+1:

I'm not sure how else to explain it other than with a video demonstration. The sensor state changes, but home assistant does not. Feel free to watch the video at 2x speed (or faster), then it is only 2 minutes.

jamesgeddes commented 2 months ago

Hi @jamesgeddes could you please write a short summarized description of your issue? I think this would be more helpful, than watching a ~4 minute video :wink: thx :+1:

Is that better?

mib1185 commented 2 months ago

The description you've added is perfect, thx 👍 Just one further question - does the state in HA never change, or at least with a delay?

vaughnabs commented 2 months ago

@jamesgeddes , i have the same issue with my blind controller, on Tuya it says open and HA closed and visa versa! if i chnage the direction on the device buttons as per tuya then HA reflects it as the opposite state! driving me crazy!

jamesgeddes commented 2 months ago

The description you've added is perfect, thx 👍 Just one further question - does the state in HA never change, or at least with a delay?

It does not change whatsoever.

jamesgeddes commented 2 months ago

@jamesgeddes , i have the same issue with my blind controller, on Tuya it says open and HA closed and visa versa! if i chnage the direction on the device buttons as per tuya then HA reflects it as the opposite state! driving me crazy!

This may be a separate issue, as mine is just not updating at all.

lrehmann commented 2 months ago

similar issue, device is updating according to Smart Life app, and last_reported changes in HA diagnostics, but the value and last_updated to not change [this is with a temperature/humidity sensor and the updated/reported times are the same including the battery level] "last_changed": "2024-08-25T02:45:01.603392+00:00", "last_reported": "2024-09-02T03:36:29.772932+00:00", "last_updated": "2024-08-25T02:47:18.214216+00:00"

lrehmann commented 2 months ago

Restarted HA and it seems to have grabbed the latest value from the sensor. Time will tell if it gets out of sync again.

Anton0123 commented 1 month ago

I have a similar or the same issue but with zip blind state. In the Tuya app the state is reflected correctly.

In home assistant they are always shown as fully open. The logbook is empty and the history shows as open 100% of the time. If i set up automations based on "blinds closing" or similar they won't trigger.

Restarting home assistant did not help.

feiltom commented 1 month ago

hello same issue with smart meter refresh counter only at restart of home assistant

mrkeepout commented 1 month ago

Hi folks! Same issue here, I tried with core 2024.6.1, it worked for a while but now it stopped again. I'll try update to the latest version again

tk2themax commented 1 month ago

same issue here ZY-M100-WiFi motion sensor. HA Core 2024.9.1, HA OS 13.1. Tuya Integration currently allows settings ( range/sensitivity etc) to be changed in HA which are then reflected in the Smart Life APP(iphone). Same in reverse. Problem is that when the "Presence Status" is not updated in HA hence and automation (to switch on CCTV monitor) in HA seems to not be acted on. Activates a power switch (sonoff S21) which otherwise responds to direct control from HA.
Here is the YAML for the Automation:

alias: Shed Motion CCTV ON description: "" trigger:

Cabana96 commented 1 month ago

Hello everyone, I have the same problem with a PIR sensor, but when I restart HA it works fine for a couple of hours, then it restarts to keep the last state for exactly 30 minutes, in fact it updates every 30 minutes instead of being real-time. restarting HA always starts working again for 2/3 hours.

jamesgeddes commented 1 month ago

I appreciate that it is not a fix per se, but I am in the process of ditching all my Tuya devices in favour of ones that provide local control, primarily Shelly. For me, that is addressing the root cause.

Josy68 commented 3 weeks ago

Hello! I have the same Problem. I change a switch but there is no response in HA. In the Tuya App on my phone no Problem