Sorry, but am I the only one waiting that the devices are supported by the “normal Tuya Integration”?
Is there a chance?
The last HA core update still didn’t let my devices have sensors…
Sorry, but am I the only one waiting that the devices are supported by the “normal Tuya Integration”?
Is there a chance?
The last HA core update still didn’t let my devices have sensors…
Someone has to write a quirk, and put it in core.
Newest core update (2025.10.0) and it’s still unsupported
That is the risk when buying Tuya Wifi devices, if it is not supported someone has to write a quirk. If you buy Tuya Zigbee devices, with Zigbee2mqtt it is easy to write a quirk yourself, but not for Wifi devices.
I’m having problems with a thermostat that doesn’t reconnect when wifi goes off for a while, with this sensor that presents the temperature in alexa but not in the integration, with a power meter that doesn’t share any metric if you don’t pay a subscription. People in Tuya are carefully making choices to get rid of the HA community. I will never buy a Tuya compatible device ever again, not wifi at least!
Anyway i have the same problem and no solutions.
I’ll replace the sensor with a tailored esphome device.
happening exactly the same to me, one of my sensor broke so i got a new one, identical to the ones i had before. Old ones are working fine but the new one is loaded as “unsupported”. Sensor is working fine as i can see the details in Tuya app !!
The issue can be seen here: two T&H sensors from a same box. The on the right works also in HA but the one on the left doesn’t, as it’s ‘status_range’ and ‘status’ fields are empty. Since the Tuya cloud registers the devices on the server side, there’s nothing we can do. GitHub has a ticket with more info on specific addreses to fix if doing Tuya Local or LocalTuya… The device with PID x3o8epevyeo3z3oa seems to be a newer device and probably already dominant in web shops. This is getting more and more people pissed on Tuya and hence changing into Sonoff etc devices…
I’m far from an expert here, but from what I can tell, the base of the problem is that the device is incorrectly registered as as power socket (tdq) when it is clearly a T&H sensor (wsdcg). Ideally, changing that would make things “just work”, but as I don’t have that power I’ve made this ugly workaround which appears to be good enough for my purposes.
First you need a script to fetch the data, I used python:
#!/usr/bin/env python3
"""Fetch T&H sensor data from Tuya Cloud API. Outputs JSON for HA command_line sensor."""
import hashlib
import hmac
import json
import time
import urllib.request
CLIENT_ID = "_PUT_YOUT_CLIENT_ID_HERE"
CLIENT_SECRET = "_PUT_YOUR_SECRET_HERE"
DEVICE_ID = "_PUT_YOU DEVICE_ID_HERE"
BASE_URL = "https://openapi.tuyaeu.com"
def api(method, path, token=""):
t = str(int(time.time() * 1000))
content_hash = hashlib.sha256(b"").hexdigest()
string_to_sign = f"{method}\n{content_hash}\n\n{path}"
str_to_sign = f"{CLIENT_ID}{token}{t}{string_to_sign}"
s = hmac.new(
CLIENT_SECRET.encode(), str_to_sign.encode(), hashlib.sha256
).hexdigest().upper()
headers = {
"client_id": CLIENT_ID,
"sign": s,
"t": t,
"sign_method": "HMAC-SHA256",
}
if token:
headers["access_token"] = token
req = urllib.request.Request(f"{BASE_URL}{path}", headers=headers)
with urllib.request.urlopen(req, timeout=10) as resp:
return json.loads(resp.read())
def main():
try:
token = api("GET", "/v1.0/token?grant_type=1")["result"]["access_token"]
path = f"/v2.0/cloud/thing/{DEVICE_ID}/shadow/properties"
props = api("GET", path, token)["result"]["properties"]
result = {}
for p in props:
if p["code"] == "temp_current":
result["temperature"] = p["value"] / 10
elif p["code"] == "humidity_value":
result["humidity"] = p["value"]
elif p["code"] == "battery_state":
result["battery"] = p["value"]
print(json.dumps(result))
except Exception as e:
print(json.dumps({"error": str(e)}))
if __name__ == "__main__":
main()
Next you need to register this in you HA config file somewhere (note, you may need to merge this into whatever you already have!):
# T&H sensor hack for Tuya bug - also in template below!
command_line:
- sensor:
unique_id: tuya_th
name: "Tuya T&H"
command: "python3 /config/scripts/tuya_th_sensor.py"
value_template: "{{ value_json.temperature }}"
unit_of_measurement: "°C"
device_class: temperature
scan_interval: 900
json_attributes:
- humidity
- battery
template:
- sensor:
- name: "Tuya Humidity"
unique_id: tuya_humidity
state: "{{ state_attr('sensor.tuya_t_h', 'humidity') }}"
unit_of_measurement: "%"
device_class: humidity
- name: "Tuya Battery"
unique_id: tuya_battery
state: "{{ state_attr('sensor.tuya_t_h', 'battery') }}"
Obviously, ensure the script is in the correct place and replace the ids and secrets from your Toya console - if you don’t already have a Tuya console login you probably don’t want to go this route!