# Node-red-contrib-tuya-smart-device : can't connect to a battery powered sensor TH08

**URL:** https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288
**Category:** General
**Created:** [3 August 2023 12:48 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288 "2023-08-03T12:48:35Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [3 August 2023 12:48 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/1 "2023-08-03T12:48:35Z")

</div>

I have connected sockets, a ceiling fan, all work well with this node because they are constantly powered.  
I bought a TH08 battery-powered thermometer/hygrometer, which works well with the TUYA app on a smartphone : measurements are uploaded every hour, and which I can find in the "`tuya iot platform`" :

 ![temphum](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b58052798fc0f92af0810fed162c1f4053485adb.jpeg)  
_Capteur T& H "online", Smart plug "online"_  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/06d190b588fb3502eb284a87e5b9d8696c651443.png)  
_measurements are uploaded every hour_

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d58d2e6891d6ac35c858f555510806d822c79053.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/2/0272be4d14a9a2784c77685720099e8f3245396c.png)  
_the smart plug is connected while the Temp/hum sensor is disconnected_

**question** : can the `node-red-contrib-tuya-smart-device` connect to a battery-powered TUYA device that only wakes up once an hour?

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [4 August 2023 01:56 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/2 "2023-08-04T01:56:01Z")

</div>

Well I'm no expert but logically if the battery device only wakes up once an hour, then you cannot talk to it while it is sleeping as it not listening at that time.

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [4 August 2023 12:58 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/3 "2023-08-04T12:58:12Z")

</div>

that's what I said to myself, so I waited for the sensor to wake up after 1 hour and try to send a CONNECT ACTION in this "opening window" of 4 seconds but the connection failed (and I don't can't retrieve the measurements).

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/1/215126adbdb4024fb27e0d298717cb0736a59c8a.png)

_Tuya IOT platform receives measurements every hour for 4 seconds_

That's why I ask myself the question does this `node-red-contrib-tuya-smart-device` work with battery sensors in deep sleep? And maybe update it to make it compatible :Sniff the sensor and wait for it to wake up to retrieve the measurements like Tuya iot platform does?

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [6 August 2023 16:53 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/4 "2023-08-06T16:53:38Z")

</div>

But doesn't it send you measurements when it wakes up anyway ?  
If you need to persist these values then store them to context when they arrive.

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [6 August 2023 17:21 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/5 "2023-08-06T17:21:15Z")

</div>

the node should connect first, and then the sensor sends the data to it, I think? The tuya-smart-device node has reconnection delays, I test on 1000ms to see... it will fall well when the sensor wakes up?

> [@Sean-McG](#):
>
> If you need to persist these values then store them to context when they arrive.

I put a DEBUG node as output if it picks up something it should display it (as I do on the other permanently powered nodes)?

how does "Tuya IOT platform" capture measurements without visibly logging in? he waits for him to connect and wait for a measurement...

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [9 August 2023 01:14 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/6 "2023-08-09T01:14:06Z")

</div>

I don't use this node so have no experience with it, however I found this info which suggests battery powered device do not work with the node.

- TuyAPI does not support sensors due to the fact that they only connect to the network when their state changes. There are no plans to add support as it's out of scope to intercept network requests.

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [28 August 2023 08:44 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/7 "2023-08-28T08:44:27Z")

</div>

Exact... even if some succeeded by entering the ID and the IP (whereas it should not be done in normal times !?:

> <https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/29#issuecomment-770400185>
>
> first of all thanks for this awsome node-red plugin
> 
> 
> Well i did insert the d…evice id and key, retrieved from tuya-cli wizard
> 
> getting this error
> 
> "Error: find() timed out. Is the device powered on and the ID or IP correct?
> 
> 
> regards

... from there, I found another way to retrieve the sensor measurements by querying "Tuya IOT platform" rather than waiting for the sensor to wake up (which does not work) like this:

> **[Tuya SDK for beginners: Intro to Tuya Cloud API - NotEnoughTech](https://notenoughtech.com/home-automation/tuya-cloud-api/)**
>
> Working with Tuya Cloud API. A guide to Cloud automation for beginners, get started with REST!

[https://github.com/notenoughtech/NodeRED-Projects/tree/master/Tuya%20Cloud%20API](https://github.com/notenoughtech/NodeRED-Projects/tree/master/Tuya%20Cloud%20API)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2ebba6c01596b0da138ef3e99c2a976f55ae5621.png)  
_the result_

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [11 September 2023 08:44 UTC](https://discourse.nodered.org/t/node-red-contrib-tuya-smart-device-cant-connect-to-a-battery-powered-sensor-th08/80288/8 "2023-09-11T08:44:52Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
