I have many temperature and humidity sensors, as well as motion ones, all connected with Tuya and all visible on HA with the official integration.
I purchased other sensors, identical to the previous ones, but these in HA have the writing “T & H Sensor (unsupported)”. Does it happen to others? How did you solve it?
What Tuya integration are you using? local Tuya or Tuya?
doesn’t this happen to anyone?
Having the same issue with a recently bought sensor.
There is also some GitHub thread about this issue; T & H Sensor (unsupported) (x3o8epevyeo3z3oa) · Issue #130949 · home-assistant/core · GitHub
A solution for Tuya Local, if sensor id = x3o8epevyeo3z3oa:
create a file e.g. TH01_temperature.yaml
content:
name: TH01, T&H Sensor
products:
- id: x3o8epevyeo3z3oa
primary_entity:
entity: sensor
class: temperature
dps:
- id: 27
name: sensor
type: integer
unit: C
mapping:
- scale: 10
class: measurement
secondary_entities:
- entity: sensor
class: humidity
dps:
- id: 46
type: integer
name: sensor
unit: "%"
class: measurement
Copy this file to
/homeassistant/custom_components/tuya_local/devices/
Before integrating, you should find out the IP,
this IP should be set to not changeable in the router.
The web call is made when you briefly press reset or insert the battery.
after 2-3 seconds, after the red light flashes, when integrating with Tuya Local you should try several times 5-7 times on average until it works.
After updating Tuya Local, the file should be recopied to
/homeassistant/custom_components/tuya_local/devices/
Since it only sends when there is a change, the sensor will not be available most of the time.
A template sensor should be inserted for this.
e.g. for /homeassistant/configuration.yaml
template: !include conf_template.yaml
/homeassistant/conf_template.yaml
- trigger: #sensor.th4_temperatur
trigger: state
entity_id: sensor.th4_temperatur
condition:
- condition: template
value_template: "{{ is_number(states('sensor.th4_temperatur')) }}"
sensor:
- name: "TH4-Temperatur-ist"
unit_of_measurement: "°C"
state: "{{ states('sensor.th4_temperatur') }}"
- trigger: #sensor.th4_luftfeuchtigkeit
trigger: state
entity_id: sensor.th4_luftfeuchtigkeit
condition:
- condition: template
value_template: "{{ is_number(states('sensor.th4_luftfeuchtigkeit')) }}"
sensor:
- name: "TH4-Luftfeuchtigkeit-ist"
unit_of_measurement: "%"
state: "{{ states('sensor.th4_luftfeuchtigkeit') }}"
th4_temperatur – from Tuya Local
TH4-temperature-ist – template sensor
How can i trigger battery state? Insert plus entity and it work but the triggerring not work! Can you help me that, High, middle, low state can save template sensor same temperature and humidity?
Thank you!
@vli3 this looks great. Do you have an issue in Tuya Local GitHub? I suppose Tuya Local integration could consider adding support for devices like these, which only update by themselves.
I think that you can just write all IDs that are not found automatically here:
It is in Settings → Devices → LocalTuya → “Configure” button on your entry → Add/Edit device
Hy,
Following your recommandation I have been able to make HA recognize my T&H tuya sensor in localtuya integration (putting 27,46,101 makes it work).
Unfortunately, the sensor always report "unknown. I have tried the -trigger solution recommanded by vli3 but without success.
As the sensor only connect to internet when tansmission is required and as HA does not when it occurs, i have try to update the sensor every seconds based on trigger templaye but it seems wrong too.
Here is my template
template:
- trigger: #sensor.tuya_t_ext
- platform: time_pattern
seconds: '*'
condition:
- condition: template
value_template: "{{ is_number(states('sensor.tuya_t_ext')) }}"
sensor:
- name: "T_Ext"
unit_of_measurement: "°C"
state: "{{ states('sensor.tuya_t_ext') }}"
state_class: measurement
unique_id: T_Ext
- name: "H_Ext"
unit_of_measurement: "%"
state: "{{ states('sensor.tuya_h_ext') }}"
state_class: measurement
unique_id: H_Ext
- name: "Bat_Ext"
state: "{{ states('sensor.tuya_bat_ext') }}"
state_class: measurement
unique_id: Bat_Ext
Any idea please !!!
Yes, I also have this problem, and not sure how to fix it.
I’ve seen somewhere on forum that this low power devices come to life once every N minutes, mine is every 1 hour and I don’t know how to trigger force synchronization in local tuya.
I’ve tried to change scan interval to 5 seconds, but it just not updating it such frequently or I’m out of time frame (device is on wifi for 3-7 seconds, avg. 5).
I’ve got THE solution.
A bit clunky but working fine.
For this you will need NodeRed and it must be connected to Home Assistant.
- Open NodeRed
- Open menu (top right)
- Manage palette
- Search and install “node-red-contrib-tuya-smart-device”
- Close palette
- Create new Flow
- Open menu (top right)
- Import
- Copy next code to a text region:
[{"id":"48a01b2342a9d9f8","type":"tuya-smart-device","z":"9fc5e5e4876edc36","deviceName":"TH01","disableAutoStart":true,"deviceId":"","deviceKey":"","storeAsCreds":false,"deviceIp":"","retryTimeout":1000,"findTimeout":"10000","tuyaVersion":"3.4","eventMode":"event-both","logLevel":"log-level-disable","x":860,"y":780,"wires":[["368a438fff2126ea","80169653855da865"],["0191b0e67a409968"]]},{"id":"368a438fff2126ea","type":"debug","z":"9fc5e5e4876edc36","name":"Output all messages","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1120,"y":740,"wires":[]},{"id":"80169653855da865","type":"function","z":"9fc5e5e4876edc36","name":"Parse Data","func":"return [\n {\n topic: \"TEMP\",\n payload: msg?.payload?.data?.dps?.[\"27\"]\n }, {\n topic: \"HUMI\",\n payload: msg?.payload?.data?.dps?.[\"46\"]\n }, {\n topic: \"BATT\",\n payload: msg?.payload?.data?.dps?.[\"101\"]\n }\n];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1090,"y":640,"wires":[["07b21dfdd6ddd0db"],["56f572541d1d9ab8"],["e2039573c1bdb1c9"]]},{"id":"07b21dfdd6ddd0db","type":"switch","z":"9fc5e5e4876edc36","name":"Is Number","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"}],"checkall":"true","repair":false,"outputs":1,"x":1270,"y":600,"wires":[["d88b0392d0dc89a4"]]},{"id":"56f572541d1d9ab8","type":"switch","z":"9fc5e5e4876edc36","name":"Is Number","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"}],"checkall":"true","repair":false,"outputs":1,"x":1270,"y":640,"wires":[["b117944bc2444b7f","a00d5a3fddb0fb6a"]]},{"id":"e2039573c1bdb1c9","type":"switch","z":"9fc5e5e4876edc36","name":"Is String","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"}],"checkall":"true","repair":false,"outputs":1,"x":1260,"y":680,"wires":[["036e714f2d2883b4","a00d5a3fddb0fb6a"]]},{"id":"d88b0392d0dc89a4","type":"function","z":"9fc5e5e4876edc36","name":"Int -> Float","func":"return { ...msg, payload: msg.payload / 10.0 };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1430,"y":600,"wires":[["799afcd70bb9ea0d","a00d5a3fddb0fb6a"]]},{"id":"1c14eaccbed47ccf","type":"inject","z":"9fc5e5e4876edc36","name":"Start Test","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":620,"y":640,"wires":[["e4399d18794ce73e"]]},{"id":"e4399d18794ce73e","type":"function","z":"9fc5e5e4876edc36","name":"Test Object","func":"return [\n { \"payload\": { \"data\": { \"dps\": { \"27\": 325 }, \"t\": 4 }, \"deviceId\": \"bf10c9082feef2247dkqig\", \"deviceName\": \"TH01 Big Room\" }, \"_msgid\": \"6af275ea3cfac2b2\" },\n { \"payload\": { \"data\": { \"dps\": { \"46\": 57 }, \"t\": 4 }, \"deviceId\": \"bf10c9082feef2247dkqig\", \"deviceName\": \"TH01 Big Room\" }, \"_msgid\": \"7041aa09c4c5c188\" },\n { \"payload\": { \"data\": { \"dps\": { \"101\": \"high\" }, \"t\": 4 }, \"deviceId\": \"bf10c9082feef2247dkqig\", \"deviceName\": \"TH01 Big Room\" }, \"_msgid\": \"82d2dfa7a540b9cd\" }\n];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":640,"wires":[["80169653855da865"],["80169653855da865"],["80169653855da865"]]},{"id":"799afcd70bb9ea0d","type":"debug","z":"9fc5e5e4876edc36","name":"Temperature","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1610,"y":600,"wires":[]},{"id":"b117944bc2444b7f","type":"debug","z":"9fc5e5e4876edc36","name":"Humidity","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1600,"y":680,"wires":[]},{"id":"036e714f2d2883b4","type":"debug","z":"9fc5e5e4876edc36","name":"Battery","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1600,"y":720,"wires":[]},{"id":"c4a7ab0a4af8ca37","type":"inject","z":"9fc5e5e4876edc36","name":"2s Interval","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"operation\":\"CONTROL\",\"action\":\"CONNECT\"}","payloadType":"json","x":630,"y":760,"wires":[["48a01b2342a9d9f8"]]},{"id":"a00d5a3fddb0fb6a","type":"join","z":"9fc5e5e4876edc36","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1590,"y":640,"wires":[["25cf65706d1e1fdf"]]},{"id":"88f1367fd989cbd9","type":"debug","z":"9fc5e5e4876edc36","name":"Result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2070,"y":560,"wires":[]},{"id":"3570656d7cbd637c","type":"rbe","z":"9fc5e5e4876edc36","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":1890,"y":640,"wires":[["88f1367fd989cbd9","120ad92108706d98","dfaa49812aba30bb","a0602dda08b5cdaa"]]},{"id":"25cf65706d1e1fdf","type":"function","z":"9fc5e5e4876edc36","name":"Remove Topic","func":"return {\n ...msg,\n topic: undefined\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1740,"y":640,"wires":[["3570656d7cbd637c"]]},{"id":"2bced59cc42ffb21","type":"delay","z":"9fc5e5e4876edc36","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1360,"y":780,"wires":[["ce2880dd057bdf95"]]},{"id":"ce2880dd057bdf95","type":"function","z":"9fc5e5e4876edc36","name":"Disconnect","func":"return { payload: { \"operation\": \"CONTROL\", \"action\": \"DISCONNECT\" } };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1510,"y":780,"wires":[["48a01b2342a9d9f8"]]},{"id":"9dd1ee9da6cec31b","type":"inject","z":"9fc5e5e4876edc36","name":"Disconnect","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"operation\":\"CONTROL\",\"action\":\"DISCONNECT\"}","payloadType":"json","x":620,"y":820,"wires":[["48a01b2342a9d9f8"]]},{"id":"0191b0e67a409968","type":"switch","z":"9fc5e5e4876edc36","name":"Is connected","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"CONNECTED","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":1210,"y":780,"wires":[["2bced59cc42ffb21"]]},{"id":"120ad92108706d98","type":"ha-entity","z":"9fc5e5e4876edc36","name":"Temperature","server":"8485343b883bf6bc","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Temperature"},{"property":"device_class","value":"temperature"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"C"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.TEMP","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":2120,"y":620,"wires":[[]]},{"id":"dfaa49812aba30bb","type":"ha-entity","z":"9fc5e5e4876edc36","name":"Humidity","server":"8485343b883bf6bc","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Humidity"},{"property":"device_class","value":"humidity"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.HUMI","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":2120,"y":680,"wires":[[]]},{"id":"a0602dda08b5cdaa","type":"ha-entity","z":"9fc5e5e4876edc36","name":"Battery","server":"8485343b883bf6bc","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Battery"},{"property":"device_class","value":"enum"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.BATT","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":2140,"y":740,"wires":[[]]},{"id":"8485343b883bf6bc","type":"server","name":"Home Assistant","version":2,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]
- Change device id, device ip, device key in tuya node (light green node on the left bottom of screenshot)
- Change name for temperature entity (both fields, first blue node on right)
- Change name for humidity entity (both fields, second blue node on right)
- Change name for battery entity (both fields, third blue node on right)
If you have problems you can increase/decrease delay for connection reset.
I will try it ! But I know nothing about node-red… quite an adventure for me !
Ok the flow works but impossible to retrieve sensor values in HA.
In the sensor “box” of node-red I have the following message:
This node requires Node-RED custom integration version 1.1.0+ to be installed in Home Assistant for it to function
My node-red-companion is in V4.1.2 butit does not work.
Very frustating ! Any clue to solve it ?
It is off topic but my Node Red companion is installed in HA and I’m still not using it.
My version is node-red-contrib-home-assistant-websocket 0.43.1
- Are you sure that you can’t see new entities in Developer Tools of Home Assistant?
- If entities are not seen in dev tools then check that your Access Token is valid (HA → Profile → Security → Long-lived access tokens).
Here how my connection settings looks:
Thanks, the error message deappears and I see the sensors in Node-red companion !
Hi All!
Actually the device of this thread is supported in xtend_tuya …
We discussed local integration (that does not requires cloud) and also worth mentioning that your dev account will be deactivated after trial ends and you will not be able to get local keys until you pay some ridiculous price (what a wonderful devices…).
These T&H sensors are my first and last smart devices that use WiFi from Tuya. I’m done with this BS.