core icon indicating copy to clipboard operation
core copied to clipboard

Tuya will not Update Data in HA-Inplementation Tuya

Open papa-aus-rastatt opened this issue 10 months ago • 25 comments

The problem

As an example, here is a sensor for light / temperature / humidity, which is connected via WIFI.

While the sensor data is updated correctly via the Tuya app, it is only updated in Tuya's HA integration when the instance is started.

Image

Image

What version of Home Assistant Core has the issue?

core-2025.3.1

What was the last working version of Home Assistant Core?

core-2025.1

What type of installation are you running?

Home Assistant OS

Integration causing the issue

tuya n

Link to integration documentation on our website

No response

Diagnostics information

no data transfered.

Example YAML snippet


Anything in the logs that might be useful for us?


Additional information

No response

papa-aus-rastatt avatar Mar 10 '25 09:03 papa-aus-rastatt

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

home-assistant[bot] avatar Mar 10 '25 14:03 home-assistant[bot]

I have the same Problem with Tempature Sensor, restart works sometimes, at Smartlife have no Problem

mrhary avatar Mar 11 '25 16:03 mrhary

Same But developers don't fix it more than 20 days...

Benj-HaRRison avatar Mar 13 '25 00:03 Benj-HaRRison

I am seeing the same problem.

My Tuya IoT Core Cloud Service is still active.

From logs tuya related rows:

Logger: homeassistant.components.vacuum
Source: helpers/deprecation.py:222
integration: Vacuum (documentation, issues)

STATE_CLEANING was used from tuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.CLEANING instead, please report it to the author of the 'tuya' custom integration
STATE_DOCKED was used from tuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.DOCKED instead, please report it to the author of the 'tuya' custom integration
STATE_RETURNING was used from tuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.RETURNING instead, please report it to the author of the 'tuya' custom integration

Logger: homeassistant.components.light
Source: helpers/deprecation.py:222
integration: Light (documentation, issues)

ATTR_COLOR_TEMP was used from tuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use kelvin equivalent (ATTR_COLOR_TEMP_KELVIN) instead, please report it to the author of the 'tuya' custom integration

Logger: homeassistant.const
Source: helpers/deprecation.py:222

STATE_ALARM_ARMED_AWAY was used from tuya, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.ARMED_AWAY instead, please report it to the author of the 'tuya' custom integration
STATE_ALARM_ARMED_HOME was used from tuya, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.ARMED_HOME instead, please report it to the author of the 'tuya' custom integration
STATE_ALARM_DISARMED was used from tuya, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.DISARMED instead, please report it to the author of the 'tuya' custom integration
STATE_ALARM_TRIGGERED was used from tuya, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.TRIGGERED instead, please report it to the author of the 'tuya' custom integration

Logger: homeassistant.backports.enum
Source: helpers/deprecation.py:222

StrEnum was used from tuya, this is a deprecated alias which will be removed in HA Core 2025.5. Use enum.StrEnum instead, please report it to the author of the 'tuya' custom integration

jweymarn avatar Mar 13 '25 10:03 jweymarn

Yep same thing happening here too

vincenzo-lukei-78 avatar Mar 15 '25 23:03 vincenzo-lukei-78

Ich möchte ergänzen, dass das Problem weg ist, wenn man sich parallel auch mit einem anderen Gerät den Wert mit der Smartlife App in der online-Ansicht ansieht. Sieht so aus, als wenn die Tuya Schnittstelle den Wert nicht aktualisiert. Auf jeden Fall zeigt HA die Zeitdauer an, wann der Wert das letzte Mal aktualisiert oder geholt wurde.

Flughafenretter avatar Mar 16 '25 13:03 Flughafenretter

I tested removing the Tuya integration and adding it again. Did not help. Problem persists.

jweymarn avatar Mar 18 '25 08:03 jweymarn

So in this thread - https://github.com/home-assistant/core/issues/136223 someone pointed out that the Tuya devices will update (and continue to update) if you have the SmartLife app (and I presume also the Tuya app) open on your mobile device at the same time as the HA companion app. This seems to do the trick for me 👍

I'm also seeing this in my logs which others are seeing too..

ConnectionResetError: [Errno 104] Connection reset by peer

vincenzo-lukei-78 avatar Mar 18 '25 09:03 vincenzo-lukei-78

I tried that with the Tuya app and it did not help in any way.

jweymarn avatar Mar 18 '25 09:03 jweymarn

Ist bei mir auch vorgekommen, dass es nicht funktioniert. Hatte aber damit zu tun, dass ich nicht auf der jeweiligen Entität in der Live-Ansicht drin war. Nur die App offen zu halten reicht leider nicht. Das ist übrigens das Hauptproblem an dem "Trick", dass es nur mit einer Entität funktioniert. Es betrifft eigentlich auch "nur" Analogwerte, die nicht aktualisiert werden. Das Hauptproblem bei der Nicht-Aktualisierung von Werten bleibt und muss gefixt werden. Leider sehe ich keine Möglichkeit den Schuldigen zu bestimmen, denn das Problem bei Schnittstellen ist, es können mindestens zwei Verursacher geben, Sender und/oder Empfänger.

Flughafenretter avatar Mar 18 '25 10:03 Flughafenretter

So I run HA as a VM within VirtualBox - and it had been very reliable and robust until recently. Have no idea why it's starting to glitch and timeout with my Tuya devices but it seems a few people are experiencing the same problem. I've managed to fix the problem within my setup but I had to roll back to Home Assistant Core v2025.2.5 and I've also altered my network adapter settings so they are using virt-io instead of E1000. Everything has been running smooth again for the last 2/3 days. Drastic measures but had to be done. Might not be a fix for everyone but it worked for me. Hoping this info might be of use to others 👍

vincenzo-lukei-78 avatar Mar 20 '25 09:03 vincenzo-lukei-78

Danke für den Vorschlag. Aber ich habe HA erst seit kurzem in Benutzung und traue mir solche Eingriffe nicht zu. Ich weiß leider auch nicht, wie die Schnittstelle zu Tuya im Detail funktioniert. Wäre es den eine Option, wenn von Seiten HA eine Zwangs-Abfrage realisiert wird? HA erkennt ja, dass z.B. 40min kein aktueller Wert mehr in HA angekommen ist. Wie kann man eine Zwangsanfrage realisieren (Polling)?

Image

Flughafenretter avatar Mar 20 '25 12:03 Flughafenretter

It’s possible to start a job every 30 minutes restarting the integration. But that means all stats only change in this Intervall. HA don’t know if a device is switch on or off till the job runs.
Something musst be changed at the Tuya site or in HA itself. With the old Version of HA 2025.2.2 everything works fine.

DieBreuers avatar Mar 20 '25 13:03 DieBreuers

I chose to give up on the standard cloud based Tuya integration and installed the Local Tuya integration through HACS. It was a bit of a learning curve how to configure the devices but now that it is done everything is perfect. Quicker response than in the past and won't need to renew the developer trial license every 6 months.

jweymarn avatar Mar 20 '25 13:03 jweymarn

Wenn Du sagst, es funktioniert mit der Version HA 2025.2.2, dann muss das Problem auf der HA Seite liegen.

Flughafenretter avatar Mar 20 '25 13:03 Flughafenretter

Ich habe mich gegen die standardmäßige Cloud-basierte Tuya-Integration entschieden und stattdessen die lokale Tuya-Integration über HACS installiert. Die Konfiguration der Geräte war etwas lernaufwendig, aber jetzt, wo alles erledigt ist, funktioniert alles perfekt. Die Reaktion ist schneller als früher und die Entwickler-Testlizenz muss nicht alle sechs Monate erneuert werden.

Ja, hatte ich früher schon mal ins Auge gefasst, zu einer Zeit, wo sie noch kein Geld für einen Entwicklerzugang haben wollten. Es scheiterte bei mir daran, dass er die IDs von meinen Geräten nicht angenommen hat. Deshalb gehe ich davon aus, dass es jetzt nicht anders ist.

Flughafenretter avatar Mar 20 '25 13:03 Flughafenretter

Meine Version ist die 2025.3.3.

Image

Ich kann mich auch nicht daran erinnern, dass es in der vorigen Version funktioniert hätte.

Flughafenretter avatar Mar 20 '25 14:03 Flughafenretter

Tuya Local is also worth a look (which is different to Local Tuya).

vincenzo-lukei-78 avatar Mar 20 '25 14:03 vincenzo-lukei-78

Yes, I had already considered it before, at a time when they didn't want to have money for developer access. It failed for me because it didn't accept the IDs from my devices. That's why I assume that it's no different now.

@Flughafenretter the "local tuya" integration is also able to connect to the tuya cloud and fetch the device IDs for you as long as you know your user ID, project ID and Tuya cloud secret key.

jweymarn avatar Mar 20 '25 14:03 jweymarn

Eins ist mir auch noch aufgefallen. Während ich Daten von verschieden Messgeräten (auch Tuya) ohne Probleme empfange, werden die analogen Daten der Steckdosen nicht aktualisiert. Egal ob das WiFi, ZigBee oder Matter Steckdosen sind. Vielleicht hilft das bei der Fehlersuche weiter?

Flughafenretter avatar Mar 20 '25 16:03 Flughafenretter

Image

In this constellation the Tuya integration works as expected.

DieBreuers avatar Mar 22 '25 14:03 DieBreuers

Hi! I had the same problem. It seems to be working again now. I deleted the Tuya integration. When I reinstalled, a window appeared asking me to enter the developer information, but the Smart Life QR code didn't appear. Even after restarting HA, it didn't appear. So I deleted the Tuya and LocalTuya folders in the custom_components folder. I restarted again, and hey presto, the QR code reappeared. After installing Tuya, the Tuya devices are now updating as usual. I hope it stays that way...

Pscharumbel avatar Mar 23 '25 07:03 Pscharumbel

Am QR-Code scheitert es bei mir nicht. Kommt jedesmal, wenn ich die Tuya Integration anstoße. Ich traue mich nicht, eine Automation mit den Werten der Tuya-Steckdosen umzusetzen, da ich damit rechnen muss, dass die Werte nicht aktualisiert werden. Solche Radikal-Eingriffe wie den ganzen tuya-Ordner zu löschen, traue ich mir nicht. Was passiert denn da noch? Sind die alten Entitäten dann noch da? Oder muss ich die dann wieder neu anlegen. Ist bei 80 Geräten dann schon Arbeit.

Flughafenretter avatar Mar 23 '25 07:03 Flughafenretter

Bei mir wurden nach der Neuinstallation die Entitäten neu angelegt. Alles wurde vom Englischen ins Deutsche umbenannt. Nachdem ich sie wieder ins Englische zurück benannt hatte, laufen alle Automationen wie gehabt. Aber ich habe auch keine 80 Geräte, sondern nur 10… Aber mach doch ein Backup und spiele es zurück, wenn was nicht funktionieren sollte.

Pscharumbel avatar Mar 23 '25 08:03 Pscharumbel

Habe jetzt den Rat befolgt und tuya noch mal komplett neu installiert. Und was kann ich sagen? Es funktioniert immer noch nicht! Der gleiche Effekt, die Steckdosen Entitäten werden mal aktualisiert und mal nicht. Es können durchaus mal Stunden vergehen, bis HA neue Daten holt. Es betrifft Zigbee-Steckdosen genauso wie WiFi.

Aber jetzt habe ich eine neue Spur. Ich habe eine einzige Steckdose, die funktioniert so wie es sein sollte und aktualisiert sich alle 5-10s.

Ich habe mal die Diagnosedaten der beiden Geräte heruntergeladen(Stehlampe, die funktioniert) und Terrassen PV (die funktioniert nicht). Wenn sich jemand die beiden Dateien mal ansehen und vergleichen kann?

tuya-01JQ3YM79Q7GT0966395XBFE9C-Stehleuchte-6d5b932ba1a7c1ffc9fd3ef3c5982ba0.json tuya-01JQ3YM79Q7GT0966395XBFE9C-Terrassen PV-26f889b9b44c1a2ace553525e86739b1.json

Flughafenretter avatar Mar 24 '25 18:03 Flughafenretter

Had the same issue. Looks like it is caused by IPV6. Try disabling IPV6 on the home assistant network interfaces and rebooting. Works perfectly for me now.

DLATHA avatar Mar 26 '25 08:03 DLATHA

Das wäre als Lösung zu schön um wahr zu sein. Habe gleich mal den gesamten IP6 Kram gesperrt und deaktiviert, leider keine Verbesserung. Würde auch meiner Beobachtung wiedersprechen, dass es bei einer von 20 Steckdosen funktioniert. Wie man im Screenshot sehen kann, erfolgte schon 18min keine Aktualisierung (bei geschlossener Tuya App).

Image

Flughafenretter avatar Mar 26 '25 13:03 Flughafenretter

It worked on some devices for me too and not others and that could be intermittent of what did and didn't work. Disabling IPv6 and rebooting HA to release the addresses has worked for me. To confirm it was disabling here that worked for me. It is a very strange one but not the first time IPv6 has caused headaches for me over the years.

Image

DLATHA avatar Mar 26 '25 15:03 DLATHA

Das Einzige was hilft, ist die Aktivierung der Tuya App auf dem Mobil Gerät (direkter Zugriff). Dann kommen sofort die Werte im HA. Was mich auch etwas irritiert ist Tatsache, dass bei der Neu-Integration der Steckdosen die Leistung erst manuell hinzugefügt werden muss. Des Weiteren ist schon komisch, dass es angeblich bei HA-Versionen unter 14.2 noch funktioniert? Ich vermute daher ein Software Problem von seitens HA. Der Vergleich der Diagnosedaten von der funktionierenden Steckdose mit der nicht funktionierenden mittels "Kompare"

Image

hat mich leider auch nicht wirklich weiter gebracht. Dort stehen für "last changed" nur bei der einen Steckdose halt der schnelle Wechsel und bei der anderen der langsame Wechsel. Das habe ich auch ohne Diagnose-File schon rausgefunden 🤔

Noch andere Vorschläge?

Flughafenretter avatar Mar 26 '25 15:03 Flughafenretter

Habe jetzt für mich die Lösung gefunden. Nachdem ich LocalTuya eingerichtet und die konkrete Entität mit einem gewünschten Abfrage-Rhythmus (in meinem Fall 10s) versehen habe, funktioniert alles so wie es sein sollte. Danach funktioniert auch die reguläre Abfrage über die normale Integration von Tuya wieder.

Flughafenretter avatar Mar 31 '25 06:03 Flughafenretter