Smarthome/J Tuya Binding for openHAB 4

Hi all,
I still have the same issue.
Is the above mention sudo command the only one i need? OH is running on version 4.1.2 and if I use addons.json or addons-snapshot.json, the install version will be tuya 4.0.0 any time.
Message will be:
“Installation of add-on json:org-smarthome-binding-tuya failed”
I tried to restart OH and also to clear cache. Nothing helped.

sudo wget … link didn´t solve the issue.

Best regards Julian

The best suggestion I have is to stop openHAB, then edit the JSON file to see if there’s still an entry for the Tuya binding.

If so, delete the entry (making sure you match parentheses), and then start openHAB. In theory that should remove the binding, but I’ve never actually tried this. I’ve only done it with things that get stuck when I try to remove them.

Hi all,

if I start OH new i will get this Message:

Reinstalling missing marketplace KAR: json:org-smarthome-binding-tuya
2024-04-20 23:06:44.966 [WARN ] [community.CommunityKarafAddonHandler] - Failed reinstalling add-on from cache
org.openhab.core.addon.marketplace.MarketplaceHandlerException: The local cache folder doesn’t contain a single file: /var/lib/openhab/marketplace/kar/json_3Aorg_2Dsmarthome_2Dbinding_2Dtuya
at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.installFromCache(CommunityKarafAddonHandler.java:163) ~[?:?]
at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.lambda$8(CommunityKarafAddonHandler.java:185) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.ensureCachedKarsAreInstalled(CommunityKarafAddonHandler.java:182) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:840) [?:?]

Any possible solutions?
Best regards Julian

Did you execute the command in the addons directory? On my system the addons are located int

/usr/share/openhab/addons/

It worked, still getting the same message at startup of OH. But TuyaCloud is working again and i can control my device. Thanks

1 Like

I transferred my SD cart from one Pi to an other PI same network, same everything. Tuya binding has communication problem, before it worked, altough not very stable either, but it was online for & week. Rebooting doesn’t help. I don’t understand why.
This binding seems very unstable.
Running openhab 4.1.3
Any pointers what to do ?

error msg in the log smile: [ding.tuya.internal.cloud.TuyaOpenAPI] - Request failed: Result{timestamp=1717706837875, code=2406, msg=skill id invalid, success=false, result=null}, no token received

Solved :

  1. login to tuya iot platform
  2. navigate to “cloud” on the left side menu bar
  3. navigate to “Link tuya app account”
  4. click unlink for your homeassistant app (i only have one account)
  5. click “add app account” and scan the QR with your phone app

Not sure why.

1 Like

Hi Alexandre, I am (still) struggling with something comparable as you: all Tuya switches/plugs work fine and can be controlled by Openhab but for a led strip (calex) I cannot control via openhab, all changes via the Tuya app are captured by openhab but the control from openhab the other way around is not working. Did you solve it yet? Best regards,
Henk

Hi Everyone,
i got one echos irrigation valve and at this point i got no idea what i am missing.
OpenHab 4.1.3
Smarthome/J Tuya Binding 4.1.0 by 3rd Party (json)

I got an Tuya Cloud Project with this specific device and the Tuya Cloud Project thing is online an connected.
My irrigation valve is displayed by automatic scan. I changed the IP Address to the fixed local WIFI Address of the valve.
I tried alle Protocol Versions (3.1,3.3,3.4) and with all of these protocols is get a connection refused in the debug logs
09:59:00:620 [DEBUG] [inding.tuya.internal.local.TuyaDevice] - bfdf30d3a98d5284c89syj/192.168.2.152:6668: Failed to connect: Connection refused: /192.168.2.252:6668

What can i do to get some more details why the connection is refused.

Best Regards & Thanks

Looks like everyone has a problem with Tuya, anyone know how to get the device IP (Zigbee), I have tried everything.

Also the device just saya “Waiting for IP address” does this come from the Tuya server or from the local Zigbee coordinator.

The Tuya binding is for WiFi devices, not Zigbee. So I don’t think you’ll get that to work.

I use Zigbee devices with a Sonoff coordinator and Zigbee2mqtt.

Welcome to openHAB! Sorry for the lack of replies. I’ve personally been quite busy over the past few months and haven’t been able to spend much time in the community.

It sounds like you’ve done everything correctly. However, you shouldn’t need to set an IP address if the device was found by openHAB, so I’d suggest removing that.

If that doesn’t help, the problem is most likely on the Tuya cloud side. An issue we often run into is that individual brands can make small changes to how their Tuya-supplied devices work. For example, InkBird changes their sensors so that they pretty much don’t work with the Tuya cloud servers or the Smart Life/Tuya Smart apps.

Unfortunately, I can’t offer any more advice than that. I’ve tried a fair number of Tuya devices with varying degrees of success.

2 Likes

Hi Russ,

thanks for your reply. The removal of the IP address doesnt work as expected and the binding waiting for the local discovery (without success).
At this Point i will change the connection to a cloud only binding without the local component. Not perfect but should work for me.

Thanks

This normally happens when you have more than one device/app connected to your Tuya device. Please make sure to have no connection open from any mobile app.
Then disable/reenable the Tuya Cloud Thing.
Regarding the IP-Address, you can find the devices MAC Adress in the mobile app.
Check your router for this MAC and you can see the IP.
I always assign the same IP to those devices in my router settings and change the name in router settings to something meaningful…

Do i need to pay for using Tuya Cloud project?

If nothing changed in the past weeks: no. There is a free trial which works without time-limit.

2 Likes

My irrigation thing turns green, if I set the IP to the IP of the gateway and use protocol 3.4.
It responds to ping with pong.
But unfortunately openhab does not receive any values from it.

Hey everyone, I might miss the obvious, but for whatever reason the binding itself / the bridge works, yet it can’t discover devices. When I switch on logging I receive the following error in OH log:

[a.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfbbd69c4af431a180udyv': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 231, Connection: keep-alive, Date: Thu, 01 Aug 2024 12:10:20 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com,https://platform.tuya.com, Gateway-Info: highway, Server: Sec, Strict-Transport-Security: max-age=31536000}, Content = {{"code":60009001,"msg":"API permission package error. For the solution, see https://developer.tuya.com/en/docs/iot/authentication-method?id=Ka49gbaxjygox.","success":false,"t":1722514220971,"tid":"061316704fff11efb4aad63cb6505ef8"}}

I am confident to have the API IOT Core, Authentication and Device status Notification enabled. The device is visible on the Tuya dashboard and the OH log also sees “something” :

product_id":"x2zcaixkwieccf6y","product_name":"Lumary Smart Ceiling Spotlight A2 ","status":[{"code

Can someone push me in the right direction maybe? As the bridge is working and the log sees something i assume its just a setting somewhere…

Has anyone encountered such behavior of the tuyaDevice? Every minute the device goes OFFLINE for 5 seconds and then returns to ONLINE.

At first I blamed a weak internet connection, but after increasing the transmission power (signal increase from -78 to -60) the behavior remains unchanged.

The device is the BAF-908 WateringDevice (microdrip irrigation) by MOES.

EDIT:
After analyzing the log, I think I found the cause and a temporary (probably final) solution, so I’ll write for others if they encounter a similar problem.
The tuyaDevice was added using a .things file, all parameters were entered perfectly, so it connected.

Unfortunately, the disconnection occurred every minute when the autodiscovery function detected the same wateringdevice that had already been added in OH using a .things file.

12:54:39.396 [DEBUG] [a.internal.local.handlers.TuyaDecoder] - udpListener: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.x.x', deviceId='bf06d5016c************', active=2, ability=0, mode=0, encrypt=true, productKey='abzzvtulukkwzynv', version='3.3', token= true, wf_cfg=true}'}
12:54:41.751 [DEBUG] [ernal.local.handlers.UserEventHandler] - bf06d5016c************/192.168.x.x:6668: IOException caught, closing channel.
12:54:41.785 [DEBUG] [nal.local.handlers.TuyaMessageHandler] - bf06d5016c************/192.168.x.x:6668: Connection terminated.
12:54:41.790 [DEBUG] [ya.internal.handler.TuyaDeviceHandler] - [tuya:ir-controller] stop ir learning
12:54:41.796 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tuya:tuyaDevice:wateringright' changed from ONLINE to OFFLINE

Unfortunately, using IGNORE in the Things INBOX box did not help - disconnections still occurred. Only deleting tuyaDevice from the file and adding them with autodiscovery and then modifying the CODE tab to add needed “dp” helped for stability.

Is there an option in the binding itself or OH4 configuration to disable autodiscovery for tuyaDevice devices?

Please do not post logs as a screenshot, as written in the community rules.
Screenshots are hard to read on mobile devices and cannot be quoted.
Post your logs as plain text in code fences.

1 Like