Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuya integration not updating entity states. #110162

Open
grahamam opened this issue Feb 10, 2024 · 27 comments
Open

Tuya integration not updating entity states. #110162

grahamam opened this issue Feb 10, 2024 · 27 comments
Assignees

Comments

@grahamam
Copy link

The problem

I have an Arlec Grid Connect Smart plug in socket that uses the Tuya integration on a Hom Assistant Green. The sock can be turned on and off and reports sensible values of current, voltage and power when it is turned on, but the values do not update. The last update was listed at 44 minutes ago as I write this.

What version of Home Assistant Core has the issue?

2024.2.1

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

tuya-5ce0396de1b63de9aa86bfaf4bb48a16-PC191HA-baaaeb4dc156c8613788090b8b267ef9 (1).json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

If I turn the outlet off and then on again in the home assistant dashboard, the entity value update once, but never again.

@home-assistant
Copy link

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)

@hiraniha
Copy link

hiraniha commented Feb 10, 2024

I am having a similar issue with pir sensors, once they detect they remain detected in HA and won't clear. A restart of HA or the integration resolves the issue temporarily, but it goes back to the same issue. Started occuring from 2024.2.0

@RackerCRO
Copy link

Same issue here with door openers. Both garage and fence are not reporting correct states, alarm panel works ok, Zigbee smart gateway and all devices connected to it work. Reloading integration updates states but next change in state isn't updated automatically.

@motogon
Copy link

motogon commented Feb 11, 2024

I am having a similar issue with pir sensors, once they detect they remain detected in HA and won't clear. A restart of HA or the integration resolves the issue temporarily, but it goes back to the same issue. Started occuring from 2024.2.0

Exactly, same problem

@nittymdev
Copy link

nittymdev commented Feb 11, 2024

Even I am having the exact problem here. Using Home Assistant in docker environment.
Post update I am unable to get the exact state of Tuya devices - both lights and sockets.

So far I have tried downgrading to 2024.1.6 - but unable to make the Tuya integration work the old way. Then had to remove it and again move up to 2024.2.1 and use the new method to authenticate - which was successful, however the issue persists.

I am also unable to connect to TP-Link Omada software controller post the upgrade to 2024.2.1.

For the Tuya integration, I see errors in the log file - which I am attaching, in case it helps fix whatever the issue is.
Thanks in advance!

home-assistant_2024-02-11T16-10-53.423Z.log

@frenck, please see if this helps.

@grahamam
Copy link
Author

grahamam commented Feb 11, 2024

In the history graph of sensor.pc191ha_voltage it seems to update the state exactly once per hour or occasionally once per two hours. Then occasionally there may be an update at some random time between the hourly update.

The attached file is from the history window download.
history.csv

@auphof
Copy link

auphof commented Feb 13, 2024

@frenck @shihuimiao @zlinoliver I have submitted a PR tuya/tuya-device-sharing-sdk#9 that fixes 1 issue and by way of a workaround around resolved the the 2nd issues effecting my Tuya PIR's and door contact sensors. The issues are similar to those described in this issue and a number of other issues. There were no changes required to HA the only changes where in tuya-device-sharing-sdk . The PR is WIP with the workaround. The maintainers (seems to be @shihuimiao ) will know where best to make a permanent fix I am happy to make changes and implement

@danielecolantonio
Copy link

Hi, I'm not yet switching to 2024.2.1 due to the problems encountered with Tuya. Has the problem of the PIRs and battery status of the TRW valves been resolved?

@fahimi73
Copy link

Hi,
My PIR not updating after update to 2024.2.1 where previously worked well. Any solutions?
thank you

@danielecolantonio
Copy link

I hope they find a solution... otherwise the tuya pir sensors are unusable

@eugeugov
Copy link

same here with PIR sensors, the " clear" state is not updating, just stuck in the "motion" one

@motogon
Copy link

motogon commented Feb 21, 2024

Looks like the tuya sensors will no longer work in HA.
sadly

@barbuslex
Copy link

barbuslex commented Feb 29, 2024

Same issue for me with a Tuya garage door opener :
Change states from closed to open works perfectly.
But when status change from open to closed (false value on switch_1), status stay on open in HA. In smart life app, the garage door states is closed.
image

@TiborJaszi
Copy link

Same issue for me with a Tuya garage door opener : Change states from closed to open works perfectly. But when status change from open to closed (false value on switch_1), status stay on open in HA. In smart life app, the garage door states is closed. image

Same issue for me, everything works except my garage door open sensor never shitches to closed state.

@hiraniha
Copy link

hiraniha commented Mar 9, 2024

Any update on this?, it's been a while now normally someone resolves these kind of issues quite quickly. I think I have seen a similar issue about pir sensor not updating, I think it's related

@grahamam
Copy link
Author

grahamam commented Mar 9, 2024

Even an acknowledgment from Tuya that this is an issue would be showing some respect to the thousands of users who are wondering when and where to turn to next.

@RackerCRO
Copy link

I guess it's not Tuya issue because in SmartLife app my garage door sensor shows door are closed but in HA it remains open. To bypass this error I'm using LocalTuya integration and with it I'm reading sensor state (because localtuya shows correct state) and every minute automation sets correct sensors state In Tuya integration.

@eugeugov
Copy link

eugeugov commented Mar 10, 2024

My workaround for PIRs stucked in the motion state.

HA Automation:

alias: PIR 2 Clear state
description: ""
trigger:
  - platform: time_pattern
    hours: "*"
    minutes: "*"
    seconds: "15"
condition:
  - type: is_motion
    condition: device
    device_id: 5f1e5aadc9217f7307c1388d6192d9c6
    entity_id: a28e3be2c626471a416ae966a1ea97b9
    domain: binary_sensor
    for:
      hours: 0
      minutes: 1
      seconds: 0
action:
  - service: python_script.set_state
    data_template:
      entity_id: binary_sensor.pir_motion_sensor_2_motion
      state: "off"
mode: single

python_scripts/set_state.py

#Set the state or other attributes for the specified entity (or create the attribute)

inputEntity = data.get("entity_id")
if inputEntity is None:
    logger.warning("===== entity_id is required if you want to set something.")
else:
    inputStateObject = hass.states.get(inputEntity)
    if inputStateObject is None and not data.get("allow_create"):
        logger.warning("===== no inputStateObject or unknown entity_id: %s", inputEntity)
    else:
        if not inputStateObject is None:
            inputState = inputStateObject.state
            inputAttributesObject = inputStateObject.attributes.copy()
        else:
            inputAttributesObject = {}
        for item in data:
            newAttribute = data.get(item)
            logger.debug("===== item = {0}; value = {1}".format(item, newAttribute))
            if item == "entity_id":
                continue  # already handled
            elif item == "allow_create":
                continue  # already handled
            elif item == "state":
                inputState = newAttribute
            else:
                inputAttributesObject[item] = newAttribute
        hass.states.set(inputEntity, inputState, inputAttributesObject)

@talik31
Copy link

talik31 commented Mar 18, 2024

I've implemented a workaround waiting for a fix for this issue.
You have to configure one of the existing tuya device from the standard integration in "LocalTuya integration" and then create an automation like:

alias: FIX - Tuya isn't updating status anymore
description: ""
trigger:
  - platform: template
    value_template: >-
      {% if states('switch.socket_room1_heater') !=
      states('switch.socket_room1_heater_localtuya') %}true{% endif %}
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition: []
action:
  - service: homeassistant.reload_config_entry
    target:
      entity_id: switch.socket_room1_heater
    data: {}
mode: single

Where :
switch.socket_room1_heater = the entity from Tuya regular integration
switch.socket_room1_heater_localtuya = the entity from LocalTuya integration

NB : It works fine for power sockets but LocalTuya isn't supporting sensors, so it won't work for the one of you suffering the issues sith PIR sensors.

@hiraniha
Copy link

Is there any update on this, seems like it's affects loads of people, with no proper alternative other that reloading the integration in some way

@hudcap
Copy link
Contributor

hudcap commented Apr 14, 2024

I rolled back to before this bug was introduced. No more updates for me until this is fixed.

@tonarmshq
Copy link

Same here… still not reliable. Some of my Tuya plugs sometimes send values, others don’t.
This sucks badly

@rairulyle
Copy link

Same here. Most of my Tuya automations stopped working because of this! It's really annoying.

@Robnex
Copy link

Robnex commented May 24, 2024

Hi. I have also the Problems Power and Voltage does not update constantly.
Installed the integration multiple times. But nothing work fine.

@tonarmshq
Copy link

Does anyone know why exactly this is happening?
Won´t there be a debugging for that?
I use a few automations depending on power and electricity usage. It´s sad to see there is nothing happening to get it stable again.

@Kdubs937
Copy link

Same issue. I have one tuya triple switch to control 2 lights and a fan. Status shows whatever the switch is at whenever home assistant boots up. Then it keeps that state regardless of actual state. Making this unusable.

@hiraniha
Copy link

Still getting this and now keep getting Tuya authentications issues too, no one seems to be investigating, I'm sure many people are being affected by both issues with the Tuya Integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests