Smarthome/J Tuya Binding for openHAB 4

What’s about OH 4 & Tuya. If I understand it correctly Smarthome/J is not yet available for OH4 SNAPSHOTs. @J-N-K states “Please note that currently no release for openHAB 4.0.0 snapshots is available.”

I had a chat with @J-N-K about that. instead o addons.json like written in the Smarthome/J readme, you need to use the addons-snapshot.json, which allows to install the openHAB4 version through 3rd party addon marketplace.
It is running here very well.

2 Likes

@J-N-K has the binding verified with the Estern US platform?

  • I registered a cloud account on that platform, added a bunch of Smart Life lights
  • I created a Tuya cloud project as described in the readme
  • installed the binding
  • and added a project thing with credentials I use in the App and the app id/secret from the cloud account
  • I selected country code 1, App Type Smart Life and data center Eastern America
  • and enabled DEBUG log

However, when the thing initializes I see ’ http://openapi-ueaz.tuyacn.com: Name or service not known’

‘’’
2023-06-10 23:00:18.326 [DEBUG] [a.internal.cloud.TuyaContentListener] - Requesting ‘https://openapi-ueaz.tuyacn.com/v1.0/iot-01/associated-users/actions/authorized-login’ (method=‘POST’, content=‘org.eclipse.jetty.client.util.StringContentProvider@671ede’) failed: openapi-ueaz.tuyacn.com: Name or service not known
2023-06-10 23:00:21.720 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content=‘DiscoveryMessage{ip=‘192.168.1.103’, deviceId=‘ebc6cd9670c36aa999xthu’, active=2, ability=0, mode=0, encrypt=true, productKey=‘keyyuwcn59gwsrr8’, version=‘3.3’}’}
‘’’

Did I anything wrong?

This has gone off topic and should perhaps be split into a separate thread. I think @hmerk can do that?

Done

Probably not. But the TUYA IoT docs say that the default is that “western America data center” (AWS) is the default for country-code 1. Did you try that? Maybe they de-activated

But the URL is wrong anyway, that is a bug. It should ne tuyaus.com, not tuyacn.com.

Fixed in latest snapshot and this afternoon in 3.2.17.

1 Like

So, do I need to remove and re-install the binding to get the fix?

Yes

ok, updated

East Data Center still doesn’t work, but
Western America brought me online and things are discovered.

However, after adding things from Inbox they have status OFFLINE / CONFIG_PENDING, “Waiting for IP address”

I never got the “Western Europe” (which is also Azure) working in Germany. Using “Central Europe” works fine. I recently came across a document from Tuya that only lists “Western America”, “Central Europe”, “China” and “India” for app-access, so maybe the others are not available for 3rd party applications.

What type of device is it and if you set the log level org.smarthomej.binding.tuya to TRACE, do you see discovery messages from these devices:

2023-01-02 07:49:58.090 [DEBUG] [.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.178.xxx', deviceId='some-id', active=2, ability=0, mode=0, encrypt=true, productKey='some-key', version='3.3'}'}

let’s continue here: Tuya/Smart Lights: Things discovered, but state "Waiting for IP address"

I am using OH4 and

  • added the URL https://download.smarthomej.org/addons-snapshot.json at services → JSON 3rd Party Addons
  • installed SmartHome/J Tuya Binding from Other Add-ons
  • created a Tuya Cloud project as described in the readme
  • connected the cloud project with my tuya App account with some smart water valves

And at this place I have a problem:

When I go to Things → add → select the SmartHome/J Tuya binding then there ist a message “No thing types can be added with this binding.”

Where can I add the “project” thing?

2 Likes

which openHAB 4 version are you using? A milestone or latest snapshot? Under “Developer Tools/API Explorer/GET thing-types”, present “Try out”, if you enter tuya as bindingId and “Execute”, what is the response?

1 Like

I use openHAB 4.0.0.M2 Milestone Build

The response is:

curl -X 'GET' \
  'http://openhab:8080/rest/thing-types?bindingId=tuya' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJraWQiOm51bGwsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJvcGVuaGFiIiwiYXVkIjoib3BlbmhhYiIsImV4cCI6MTY4NzIwODI5NSwianRpIjoiV0Y1cEtGRGpUX3BzNjQ3YUJTNS0zQSIsImlhdCI6MTY4NzIwNDY5NSwibmJmIjoxNjg3MjA0NTc1LCJzdWIiOiJhZG1pbiIsImNsaWVudF9pZCI6Imh0dHA6Ly9vcGVuaGFiOjgwODAiLCJzY29wZSI6ImFkbWluIiwicm9sZSI6WyJhZG1pbmlzdHJhdG9yIl19.eFJTv_k0u4VROsT5zB2z2WjAdwfBb7XR-wDDrbRfrdMZ-dZY6fzn5iHxPpmnYNESRSU0uJsqIDGIYy12sNN1f41CsmxD60lIdu-afkA0OziqxyzF4r74yAwiJSDW0vYoKZg2um7pZc1tT9oxLbZrfKOybLpp5_wbffnWTOsBJYtur4pfzFApd-T0dxyPnn2bFBdfqu2feiPISilPVRAmeAVNbDvAfvkuR-cVM6tOZzfgg6sgM1AwuX0T9MBQj6GnKhc-yDP_2gMWX_ithHYRHaVPDtWSTiBAL0Vx95JZ1oPtKXeB5USdNjnW4vBfZYvq6ouAeU0STZH5hIksQYkeqg'

I made the update to M3.

The response ist:

curl -X 'GET' \
  'http://openhab:8080/rest/thing-types?bindingId=tuya' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJraWQiOm51bGwsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJvcGVuaGFiIiwiYXVkIjoib3BlbmhhYiIsImV4cCI6MTY4NzIwOTExNiwianRpIjoiMGZSRWJCZ1pDd3k5N3BoQk81NHpqdyIsImlhdCI6MTY4NzIwNTUxNiwibmJmIjoxNjg3MjA1Mzk2LCJzdWIiOiJhZG1pbiIsImNsaWVudF9pZCI6Imh0dHA6Ly9vcGVuaGFiOjgwODAiLCJzY29wZSI6ImFkbWluIiwicm9sZSI6WyJhZG1pbmlzdHJhdG9yIl19.B4oHnB5zSMffaHNrDPVqUXaWWmJhUUOUpeBWext4AKqBJHD2mGHgVSgbAuis5E0MZVcY0xzFkBae3ZV5G13D3NZJnVNaw1VMHX_al9SyYwRUoSEVbkDYr3jMfQgpVkZDnERHeRUnZWVn3NagUPwE9dTmhnWWNtm1AsPYd_4f9-iwjiULW6-vneWkQRZAWceKoiCikSyVvNeWNI8KCLMO0cJsSa5Y7f7xzdXGmkLgtsaaxIKRax10fL594PfbZd6uf6pQVQKs-1xM6cJPmnxRT_XhdUXG3rwrHGMdbZ1o74zb_r1YKC-cuFKHasOqaRfGjgmZ0sVkAr-3f-rRTgLx1g'

Hi

I have the exact same problem. I’m on M3 too and the result of the REST API call is:

I hope this help to identify the problem.
Kind regards

Just upgraded to the M4 build and it seems to work again now.
I can add the project as intended.

1 Like

For future reference, On OpenHab 4 M4 my mistake was that I was adding as 3rd Party Add-on Service
https://download.smarthomej.org/addons.json —> Wrong
https://download.smarthomej.org/addons-snapshot.json —> Correct

Thank you @J-N-K and @GebDat for mention

Hi All,
I have the same problem despite I think I’ve done all what the steps describle by the other users.
The issue just occured after upgrading from 3.2 → 4.0

  • I’ve added the link https://download.smarthomej.org/addons-snapshot.json in 3rd Party Add-on Service
    as it didn’t fix the issue, then
  • I’ve delete the Tuya thing and the Tuya Cloud Project
    now when I would like to add the Tuya Thing it returns me:
    No thing types can be added with this binding.

I’m running the following version:
openHAB 4.0.0
Release Build

OH Version
also here is attached the output of API Explorer

And the 4.0.0 Snapshot version of the Tuya binding:

Regards

Youness