Smarthome/J Tuya Binding for openHAB 4

As you suspected, to be controlled by openHAB, the Tuya device needs to be on the same LAN as the device. And as you observed, the Tuya binding doesn’t play well with the Tuya app.

You would need another openHAB install at your dad’s house. I have two installs and they communicate well with each other using the Remote binding through Tailscale. But I have had enough issues with Tuya Things going offline unpredictably that I wouldn’t trust my father’s safety to a set up that relied on it and the stability of a remote connection

Thanks, I am currently using the Tuya App for that device, too much infraestructure for only that, and also I need Tuya for two Irrigation Controllers that connect to a Tuya Hub using RF not WiFi or Zigbee and can’t be controlled using that (and any other) binding or library.

Ruben

Strange thing with this tuya binding. I have devices for watering plants (Moes BAF-908) and last year I used them with this binding. I disconnected the devices for the winter and uninstalled the Smarthome/J binding.
Now when I tried to restore everything relatively quickly, something didn’t work.
I managed to generate a Tuya Cloud Project that connects and is online with the iot.tuya.com account. Unfortunately, discovery and Scan to discover tuyaDevice (I have two) don’t work…
Openhab log-viewer returns the information:

WARN org.smarthomej.binding.tuya.internal.local.handlers.TuyaDecoder bf06d5016c33f4ba55lxxx/192.168.x.xx:6668 failed to parse JSON: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

any ideas what could be reason?
I have some logs from the Karaf console but it looks like there is a lot of sensitive data there

In case it helps someone: I have added a Tuya Circuit Breaker through PaperUI which started to act up, i.e. toggling between ONLINE-OFFLINE. It flicked to Online for like 0.3 seconds then back to OFFLINE. It is on a router assigned fix IP.

Stuff like this in the log

2025-06-08 11:10:44.878 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener: Received MessageWrapper{commandType=BROADCAST_LPV34, content='DiscoveryMessage{ip='192.168.0.74', deviceId='bfdabdc5050b04b22bfnj0', active=2, ability=0, mode=0, encrypt=true, productKey='457pojpide0bgwvc', version='3.4', token= true, wf_cfg=true}'}
2025-06-08 11:10:45.083 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA0000000000000023000000EC0000000023D01E5FEF56833314CEF60FB086ED334D0AE445C44FA142F7C46F4670179E14894A5BFA2A1E1D2AEE353635258F3BB3D40753585C8F08CB095010E641C2B209C2FB8459B1155FC75D4BF6699F92CBA4C0BA520148045E7605FA0498DFEA5AAB2E2E953E99319B1C600BD13301F20BA26C2C8E3C4989AC8613E52AC95461835AE06E896556D145936B394073B3F883562EA387F7B800F3ECB942B259D8198700E1C6BD1F81C1990BDD6AB8202B5060E74058DA4A72DF8AAE7B3770ADE1899F376FD9659AE77C5555BB52E0A24EE389760CE7A6AFCF875CF6AD2F4756424933000E1508A30000AA55'
2025-06-08 11:10:45.086 [TRACE] [.internal.local.handlers.TuyaDecoder] - udpListener: Decoded raw payload: 7B226970223A223139322E3136382E302E3736222C2267774964223A226266666530316663393761323731313636357271646E222C22616374697665223A322C2261626C696C7479223A302C22656E6372797074223A747275652C2270726F647563744B6579223A226B65796D3535376E717733703870376D222C2276657273696F6E223A22332E34222C226C616E5F636170223A3530302C226C616E5F736571223A332C226C616E5F61626C696C7479223A312C22746F6B656E223A747275652C2277665F636667223A747275652C22636C69656E744C696E6B223A317D01
2025-06-08 11:10:45.259 [DEBUG] [.internal.local.handlers.TuyaEncoder] - bfdabdc5050b04b22bfnj0/192.168.0.74:6668: Sending payload 46C6A59BA7882ED6570EBE3E8663EFA5
2025-06-08 11:10:45.260 [TRACE] [.internal.local.handlers.TuyaEncoder] - bfdabdc5050b04b22bfnj0/192.168.0.74:6668: Sending encoded '000055AA000000010000000300000044BD5BC5D432C0D4092397A37AAF653FA32C03FBB752DDED02B7F8523A4E4450D3C8428F26F016E750C27F44C0F99596960BA1695A8CF5ABA0EDFCF6FC050D06830000AA55'
2025-06-08 11:10:45.262 [DEBUG] [al.local.handlers.TuyaMessageHandler] - bfdabdc5050b04b22bfnj0/192.168.0.74:6668: Connection established.
2025-06-08 11:10:45.376 [DEBUG] [al.local.handlers.TuyaMessageHandler] - bfdabdc5050b04b22bfnj0/192.168.0.74:6668: Connection terminated. 

The solution which helped (after removing/adding again; entering fix ip to the binding; playing with protocols; restarting OH) was a complete power cycle - i.e. take away the mains from the circuit breaker. Following that it works as expected. I hope it helps someone.

Anybody knows if this binding will work with new OpenHAB 5.0.0?

The Tuya binding has been contributed as an official addon, so it is even included with 5.0.

Is that one, I mean if all configuration, things, items are compatible?

And thanks so much for that work!

Ruben

Can you share the best way to use one tuya cloud account, one project with multiple instances of openhab tuya binding? Devices seems to work but in the logs there are issuse with token error. can i leave it as it is or it will stop working in the future ?:slight_smile:

I have exactly this situation - two separate openHAB installations using the same Tuya SmartHome account. And as you have observed, you get a “This never should happen” warning when you have both of the Tuya account things online.

As I understand it, you only really need the Tuya account to get the description code for new things when they are added. So.I generally keep at least one of them disabled until I get a new device and need to add it.

Unfortunately it still doens’t work on 5.0.1… Same thing… Funnily enough, my other Tuya devices work fine, only the circuit breaker doesn’t.

I just got a Tuya WiFi thermometer. Then I discovered that the Tuya binding is only available officially for openHAB 5.

I am still on 4.3.8 (will likely migrate during the holidays). Is a version of the binding for openHAB 4.3.8 still available for download somewhere?

Thanks!

Hi,
I am trying to add my Tuya Wallbox to OH. I have setup the account and linked it. The discovery is working but after adding the Wallbox to OH there are no configured channels.

I tried to add them but a “DP” is missing which only accepts numbers. I found some specifications in the Cloud project but all “DP” related are alpha numeric. Any suggestions?