How to use a Tuya Wireless Wifi Sensor with TuyAPI MQTT (ByAgentK)

Ok I trust you ^^

Definitely do not trust me :smile: . You should reproduce in your system.

Looking forward for the updates!

1 Like

Yes I will make a new project with a new account to be sure :smiley:

Update : Temperature change and my channel update correctly !

Hello @ricardol !
Some news about the operation of the binding.
The binding works well with my switch, and seems to be ok for my battery-powered sensor.
I had to create a small js script to divide my value by 10 because my sensor sends 205 for 20.5Ā°Cā€¦
The binding seems to get the value, but it seems that it misses some sensor updatesā€¦
Itā€™s better than my solution (with AgentK/tuyamqtt) where I tried to connect to the device all the time, but itā€™s not perfect.

Hey @Roms ,

I believe there is some work on that front. See:
Tuya energy metering polling interval Ā· Issue #397 Ā· smarthomej/addons Ā· GitHub, Does this apply yo tou?

Thanks

Thank you, I have read about this Polling Interval but I had left it at 0.
I try to configure it to 10 (10sec) and see if it solve the problem.

Iā€™ll keep you informed ! But it looks good after a few minutesā€¦

Your devices is battery powered, unlike the power monitor in the ticket, so it might not work. If it does not work, i would recommend you to open a ticket with the binding developer.
Thanks!

Yes I will test this until tomorow :wink:

Hi @ricardol
It seems the issue was already reported, but no news about it:

So the problem still here.
For example at the moment, I have 18.5Ā°C and 59% in Openhab (last change is was around 9am), but in Tuya Smart App I have 18.9Ā°C and 60% (3 changes from 9am)ā€¦

That is too badā€¦
You can always ask the developer if there will be any activity on that frontā€¦
The really bad news is that it looks like battery operated sensors cannot be disconnected from the cloud resources, if you want proper operationā€¦

There is a project called openbleken that itā€™s supposed to be a tuya firmware replacement. That could be another path to exploreā€¦

I will try to log to see how the Tuya Binding works with the sensor.
But I donā€™t understand how to use the log:set command.
In the Tuya Binding project readme file it is said :
" Type log:set TRACE org.smarthomej.binding.tuya on the Karaf console to enable TRACE logging"

You first need to log into the karaf console.
On linux, you do that by connecting to your openhab instance over ssh and running openhab-cli console

Once your are on the console, you can set up the log level of the binding as per the instructions.

To watch the logs on real time, also on the karaf console, enter
log:tail

I am not sure this is something that can be resolved. If the devices are not capable of sending notifications locally, it will be difficult to sort out

Thank you @ricardol

I have make some logs.
I can see the binding try to connect to my battery-powered sensor periodicaly and failed. He failed every 7 seconds. But I donā€™t know the time between two attemps.

Here is a trace after a connection established:

... Connection to battery-powered sensor (xxx.xxx.1.71) established
20:15:09.685 [DEBUG] [nal.local.handlers.TuyaMessageHandler] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Connection established.
20:15:09.692 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:xxxxxxxxxxxxxxxxxxwo0b' changed from OFFLINE to ONLINE
20:15:09.787 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Received encoded '000055AA000000010000000A0000003C00000000C20A63C0F3E834D01EE9C6D0305488CA8FAE8413FD671D84A76AF8EA9089AF31606A7082CA95BA3ED0CF46D55EBE701ABDDFACC30000AA55'
20:15:09.794 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxwo0b//192.168.1.71:6668: Decoded raw payload: {"dps":{"1":285,"2":47,"3":"high"}}
20:15:09.797 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxwo0b//192.168.1.71:6668: Received MessageWrapper{commandType=DP_QUERY, content='{1=285.0, 2=47.0, 3=high}'}
20:15:09.801 [TRACE] [ya.internal.handler.TuyaDeviceHandler] - 'tuya:tuyaDevice:xxxxxxxxxxxxxxxxxxwo0b' received status message '{1=285.0, 2=47.0, 3=high}'
20:15:09.840 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'temphumsallemanger_vatemperature' changed from 29.7 Ā°C to 28.5 Ā°C
20:15:09.847 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'temphumsallemanger_vahumidity' changed from 48 to 47
20:15:09.852 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'temphumsallemanger_batterystate' changed from middle to high
... PING battery-powered sensor => NO Response received : Device seems to be OFFLINE ?
20:15:19.691 [TRACE] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending ping
20:15:19.698 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending HEART_BEAT, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626119, dps=, gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:15:19.703 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA000000020000000900000097332E330000000000000000000000004A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F9425647549B8C6CD11EE0013FCA96C281E35479BCF797F66E6954EDA44BF0D66EF1532BDE6F21B7A83073852C690E2CAF8166A39876CE345174014D24EB1CB4DB6C48A02789BD0F60000AA55'
20:15:19.708 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending DP_REFRESH, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626119, dpId=[4, 5, 6, 18, 19, 20], gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:15:19.712 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA0000000300000012000000984A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F9425647549B8C6CD11EE0013FCA96C281E35479B7E35BC2E662C5D60CFAC66F2E5F004F6F85F5691AF41422439BCAA2F799B0ADA98E07C26EAA8A19979DECCB6B0B022F7256DE6CB5BED06FB9C7118CB56A1B4244BBAD2A90000AA55'
... PIN on others no-battery powereddevices => Response received
20:15:20.491 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Received encoded '000055AA00000000000000090000000C00000000B051AB030000AA55'
20:15:20.501 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxh8pv//192.168.1.8:6668: Decoded raw payload:
20:15:20.505 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxh8pv//192.168.1.8:6668: Received MessageWrapper{commandType=HEART_BEAT, content=''}
20:15:20.509 [TRACE] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Received pong
20:15:23.444 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802ABEF1DD6A630EF571E60FFF031A164DC16CE2367FD766E5CB41748CC4C559481C39C905A62E2923EDAE83D06EC72EFA53E5009CA4C2B6940FF0C50C5E4948159F02DA2D7BF10B10284B5270BC2B6FD2313A6B2D0D20FC7AC658D6DD014B00CA233B29CF340EE262851E7D025136A44AE549D7C04D4BD0E855432B819CBF4452F6CC12D3C30000AA55'
20:15:23.449 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.8","gwId":"xxxxxxxxxxxxxxxxxxh8pv","active":2,"ablilty":0,"encrypt":true,"productKey":"xxxxxxxxxxxxxxxx","version":"3.3"}
20:15:23.455 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.8', deviceId='xxxxxxxxxxxxxxxxxxh8pv', active=2, ability=0, mode=0, encrypt=true, productKey='xxxxxxxxxxxxxxxx', version='3.3'}'}
20:15:23.921 [TRACE] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxkivp/192.168.1.50:6668: Sending ping
20:15:23.924 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxkivp/192.168.1.50:6668: Sending HEART_BEAT, payload {devId=xxxxxxxxxxxxxxxxxxkivp, uid=xxxxxxxxxxxxxxxxxxkivp, t=1668626123, dps=, gwId=xxxxxxxxxxxxxxxxxxkivp}
20:15:23.927 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802AB07FF230951437798EBF0CDC9AC665EC0A3261B7479DE44B7C0502A93CCBFF0B3514F2BC1748D281E9824EACC6FE7432C2FB8459B1155FC75D4BF6699F92CBA4C0BA520148045E7605FA0498DFEA5AABEF4D0C3C7F3A97278AD778D2B0563E0CFE59315F2E2C48DB746AC0268A4E49F76EDA8EEA40E93B1E3FC14A2570E18279C731E6C80000AA55'
20:15:23.932 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.50","gwId":"xxxxxxxxxxxxxxxxxxkivp","active":2,"ablilty":0,"encrypt":true,"productKey":"xxxxxxxxxxxxxxxx","version":"3.3"}
20:15:23.935 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.50', deviceId='xxxxxxxxxxxxxxxxxxkivp', active=2, ability=0, mode=0, encrypt=true, productKey='xxxxxxxxxxxxxxxx', version='3.3'}'}
20:15:23.928 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxkivp/192.168.1.50:6668: Sending encoded '000055AA00001CEE0000000900000097332E3300000000000000000000000038375913C9509BEE388C44253ED4A7D598A1F160EFA86A9DAEA56377F603C6FF3962257D4D27CE2832D1F6EA0CE1329C11214C147B1603424D60C2DD380BDA363105C4186A7F3525241F4EE28007D77AE1DE7D541850923341B075C791E1907678E6BDF72CDBAACBD4FF87CACD469EBD94CA2096FAB5BE17A8F5293117CFF6143232ED970000AA55'
20:15:24.003 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxkivp/192.168.1.50:6668: Received encoded '000055AA00000000000000090000000C00000000B051AB030000AA55'
20:15:24.006 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxkivp//192.168.1.50:6668: Decoded raw payload:
20:15:24.009 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxkivp//192.168.1.50:6668: Received MessageWrapper{commandType=HEART_BEAT, content=''}
20:15:24.012 [TRACE] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxkivp/192.168.1.50:6668: Received pong
20:15:28.092 [TRACE] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Sending ping
20:15:28.095 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Sending HEART_BEAT, payload {devId=xxxxxxxxxxxxxxxxxxh8pv, uid=xxxxxxxxxxxxxxxxxxh8pv, t=1668626128, dps=, gwId=xxxxxxxxxxxxxxxxxxh8pv}
20:15:28.098 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Sending encoded '000055AA000001350000000900000097332E330000000000000000000000008547069C89446644491ABA22B7BEC3280DE543329B21C2745EA77295107F5396DD2885A017DE1ABC5A177D3D3DDCF08EEB0024ACB2DA87A4E1216462816AFB4E7577006E75C6C07463C60D6C99C4DB182CAFAC93EC165FE9231DFAFA66ED71EA41C577D65E7C45174D01F1ED63ACD7016E2711E56BBA09B2933AF60A8D6E5A7438E8F83A0000AA55'
20:15:28.124 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Received encoded '000055AA00000000000000090000000C00000000B051AB030000AA55'
20:15:28.127 [TRACE] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxh8pv//192.168.1.8:6668: Decoded raw payload:
20:15:28.130 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - xxxxxxxxxxxxxxxxxxh8pv//192.168.1.8:6668: Received MessageWrapper{commandType=HEART_BEAT, content=''}
20:15:28.134 [TRACE] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxh8pv/192.168.1.8:6668: Received pong
20:15:28.446 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802ABEF1DD6A630EF571E60FFF031A164DC16CE2367FD766E5CB41748CC4C559481C39C905A62E2923EDAE83D06EC72EFA53E5009CA4C2B6940FF0C50C5E4948159F02DA2D7BF10B10284B5270BC2B6FD2313A6B2D0D20FC7AC658D6DD014B00CA233B29CF340EE262851E7D025136A44AE549D7C04D4BD0E855432B819CBF4452F6CC12D3C30000AA55'
20:15:28.449 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.8","gwId":"xxxxxxxxxxxxxxxxxxh8pv","active":2,"ablilty":0,"encrypt":true,"productKey":"xxxxxxxxxxxxxxxx","version":"3.3"}
20:15:28.453 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.8', deviceId='xxxxxxxxxxxxxxxxxxh8pv', active=2, ability=0, mode=0, encrypt=true, productKey='xxxxxxxxxxxxxxxx', version='3.3'}'}
20:15:28.928 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802AB07FF230951437798EBF0CDC9AC665EC0A3261B7479DE44B7C0502A93CCBFF0B3514F2BC1748D281E9824EACC6FE7432C2FB8459B1155FC75D4BF6699F92CBA4C0BA520148045E7605FA0498DFEA5AABEF4D0C3C7F3A97278AD778D2B0563E0CFE59315F2E2C48DB746AC0268A4E49F76EDA8EEA40E93B1E3FC14A2570E18279C731E6C80000AA55'
20:15:28.934 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.50","gwId":"xxxxxxxxxxxxxxxxxxkivp","active":2,"ablilty":0,"encrypt":true,"productKey":"xxxxxxxxxxxxxxxx","version":"3.3"}
20:15:28.938 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.50', deviceId='xxxxxxxxxxxxxxxxxxkivp', active=2, ability=0, mode=0, encrypt=true, productKey='xxxxxxxxxxxxxxxx', version='3.3'}'}
20:15:29.692 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending DP_REFRESH, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626129, dpId=[4, 5, 6, 18, 19, 20], gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:15:29.695 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA0000000400000012000000984A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F94256475931824D99EC823D69E05083E640BEFC57E35BC2E662C5D60CFAC66F2E5F004F6F85F5691AF41422439BCAA2F799B0ADA98E07C26EAA8A19979DECCB6B0B022F7256DE6CB5BED06FB9C7118CB56A1B424DBB3D8480000AA55'
20:15:33.927 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C00000000D09766676F3369EB10B5E9F132FD802AB07FF230951437798EBF0CDC9AC665EC0A3261B7479DE44B7C0502A93CCBFF0B3514F2BC1748D281E9824EACC6FE7432C2FB8459B1155FC75D4BF6699F92CBA4C0BA520148045E7605FA0498DFEA5AABEF4D0C3C7F3A97278AD778D2B0563E0CFE59315F2E2C48DB746AC0268A4E49F76EDA8EEA40E93B1E3FC14A2570E18279C731E6C80000AA55'
20:15:33.930 [TRACE] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.1.50","gwId":"xxxxxxxxxxxxxxxxxxkivp","active":2,"ablilty":0,"encrypt":true,"productKey":"xxxxxxxxxxxxxxxx","version":"3.3"}
20:15:33.933 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.1.50', deviceId='xxxxxxxxxxxxxxxxxxkivp', active=2, ability=0, mode=0, encrypt=true, productKey='xxxxxxxxxxxxxxxx', version='3.3'}'}
... PING battery-powered sensor => NO Response received : Device seems to be OFFLINE ?
20:15:39.693 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending DP_REFRESH, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626139, dpId=[4, 5, 6, 18, 19, 20], gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:15:39.697 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA0000000500000012000000984A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F94256475AF16BCC32CEFCA1518127E8AB28866A07E35BC2E662C5D60CFAC66F2E5F004F6F85F5691AF41422439BCAA2F799B0ADA98E07C26EAA8A19979DECCB6B0B022F7256DE6CB5BED06FB9C7118CB56A1B42481F4CD700000AA55'
... PING battery-powered sensor => NO Response received : Device seems to be OFFLINE ?
20:15:49.693 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending DP_REFRESH, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626149, dpId=[4, 5, 6, 18, 19, 20], gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:15:49.698 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA0000000600000012000000984A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F942564752FBE27EE4040DF84C93263FB4547DDED7E35BC2E662C5D60CFAC66F2E5F004F6F85F5691AF41422439BCAA2F799B0ADA98E07C26EAA8A19979DECCB6B0B022F7256DE6CB5BED06FB9C7118CB56A1B424E684C2D90000AA55'
... PING battery-powered sensor => NO Response received : Device seems to be OFFLINE ?
20:15:59.693 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending DP_REFRESH, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626159, dpId=[4, 5, 6, 18, 19, 20], gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:15:59.696 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA0000000700000012000000984A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F94256475CC6BA35DC3FB0D136A323C9BE205F5037E35BC2E662C5D60CFAC66F2E5F004F6F85F5691AF41422439BCAA2F799B0ADA98E07C26EAA8A19979DECCB6B0B022F7256DE6CB5BED06FB9C7118CB56A1B424AAB9B26F0000AA55'
... PING battery-powered sensor => NO Response received : Device seems to be OFFLINE ?
... 60 sec passed Binding estimate Connection lost
20:16:09.694 [DEBUG] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending DP_REFRESH, payload {devId=xxxxxxxxxxxxxxxxxxwo0b, uid=xxxxxxxxxxxxxxxxxxwo0b, t=1668626169, dpId=[4, 5, 6, 18, 19, 20], gwId=xxxxxxxxxxxxxxxxxxwo0b}
20:16:09.699 [TRACE] [a.internal.local.handlers.TuyaEncoder] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Sending encoded '000055AA0000000800000012000000984A8EF63086C0E04A1262B97856F4F4051C970ADD9A91FAF1F6784B45FD9B4BE36CE60A817E0D7AF1DCB7F6ECEDA7B166733E8E28CF20F3FB3498C31F94256475D872F9AF7064D16D6B28BE9AC586458D7E35BC2E662C5D60CFAC66F2E5F004F6F85F5691AF41422439BCAA2F799B0ADA98E07C26EAA8A19979DECCB6B0B022F7256DE6CB5BED06FB9C7118CB56A1B4243F6495180000AA55'
20:16:09.831 [WARN ] [ernal.local.handlers.HeartbeatHandler] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Did not receive a message from for 60 seconds. Connection seems to be dead.
20:16:09.835 [DEBUG] [nal.local.handlers.TuyaMessageHandler] - xxxxxxxxxxxxxxxxxxwo0b/192.168.1.71:6668: Connection terminated.
20:16:09.841 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:xxxxxxxxxxxxxxxxxxwo0b' changed from ONLINE to OFFLINE

After connection Binding try to ping every 10seconds, but the device is already Offline before the first ping (less than 10sec)

So the behavior seems to be equal to the Tuya-Mqtt by AgentK with the decrease of the retry connection time from 10sec to 100ms : Try to connectā€¦ failed after 5secā€¦ retry after 100msā€¦
Maybe the TuyaMqtt was faster than this Binding

I guess this issue will not have a real solution until tuya provides a way for the devices to send notifications and updates to a local endpointā€¦

Unfortunaly I think tooā€¦

I have created an issue report to the developer.
https://github.com/smarthomej/addons/issues/418

We will keep searchingā€¦if i had a door sensor or something, i would try that openbleken firmwareā€¦if it works, i would probably remove tuya from all my devicesā€¦

Tuya devices work well with this api or the Mqtt Tuya api, but only if they are always connectedā€¦

For other devices like battery powered sensors, I think itā€™s better to use zigbee (Iā€™ll try that the next day).

Hello @ricardol

I have found this topic about a ā€œWiFi door/windows sensorā€ [ā€¦] ā€œThe contact connects to the WiFi only to transmit the status change, it does not remain connected continuously.ā€

And here is maybe a solution:

However, I did find a bit of a workaround, utilising Alexa. You need to expose a Switchable Item from openHAB to Alexa, and then set up two Routines - one for when the Smart Life sensor reports ā€œOpenā€, and another when it reports ā€œCloseā€, which will change the state of this openHAB Item.
Reaction time wasnā€™t too bad - generally within a second or so of the status changing in SmartLife, it also reported in openHAB.
But, it does rely on the cloud for, SmartLife, Alexa AND openHAB to all be functioning, and performant.

This may be a solution for these types of sensors. However, as I understand it, it canā€™t work only locally, it has to be connected to the Cloud.
I will try this solution only for my sensor to see if it works!

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