Tuya-mqtt...never ending story?

  • Platform information: Raspberry Pi 4
    OH 3.4

Hello,

I read a lot…got tuya-mqtt running on my Pi4 with OH 3.4.
Having “Vecino” RGBW light panels, local keys and id are put into
the devices.conf. But my MQTT Explorer only shows message
that they are online. No way to control them.
When I run my smartphone app (Tuya Smart) debugging
in the oh console tells me that the device is connected. When
I control the device e.g. switching it on/off there is an answer
in the debug like:
Automatic discovery of Tuya bulb settings failed and no manual configuration +
I get some sort off key as an answer from the device but no “dps-messages” like in the description.
Can anyone please help me?
Thanks a lot!

I can’t help with the specific problem you are trying to solve, but I have had good luck with my Tuya devices with addons/bundles/org.smarthomej.binding.tuya at 3.2.x · smarthomej/addons · GitHub.

I have various Tuya devices that seem to work fine with Openhab (sometimes working out how to send commands in Openhab can be tricky…)

I use the wizard to create my devices.conf entry then the merge script to bring them in. But you should be able to see the status on MQTT with just tuya-mqtt as it’s independant of Openhab. Then Step 2 is to get the status and control from Openhab.

Possibly print your device.conf and the debug output of the tuya-mqtt log when you turn the light on and off from the Tuya App

Also when you login to the iot developer portal can you see your devices there?

Just to confirm is your issue that you don’t see the various status in MQTT or is MQTT is fine but you cannot read into or control from OH?

Thank you so much for your answers! I actualy did try the smarthomej binding, but I couldn’t control my lamps with it completely. Color or white mode worked. But not the Dimmer channel for controlling the brightness. ON/OFF didn’t work either. So I decided do deinstall it and give it a try with tuya-mqtt…
However, after having deinstalled the smarthomej binding from
GUI and restarting OH I saw in caraf console that the smarthomej
tuya binding (3.2) was still hanging arround in the bundle list…
At the moment I’m running an openhab-cli clean-cache, hoping to
get rid of it…
I read there is a tuya-cli with the command “get” + ID + Key and some more options. The answer should be some jason stuff with
dp.
Can anyone tell me this command, so I could just put in my ID etc?
At least I can calm down…Tuya-mqtt seems to work. I’ll just have to find out how to start it.

I got ON/OFF to work by creating a new channel in the UI using the “Switch DP” datapoint number I could see in the Brightness channel configuration in the UI. I have the dimmer working on the brightness channel for a dozen lights. I will look back and see if I did something special to make that work. My recollection is that there was something that confused me but it was a while ago and I can’t remember off the top of my head.

How long ago did you try the dimmer? I found a thread from GitHub where I helped the developer fix it by changing the ItemType of the brightness channel from Number to Dimmer.

https://github.com/smarthomej/addons/issues/342

When I press the OH Switch DEBUG sends:

 tuya-mqtt:command Received MQTT message ->  {"topic":"tuya/VECINO RGBW 3/command","mes                sage":"OFF"} +0ms
  tuya-mqtt:error TypeError: Cannot read property 'processCommand' of undefined
  tuya-mqtt:error     at MqttClient.<anonymous> (/opt/tuya-mqtt/tuya-mqtt.js:159:32)
  tuya-mqtt:error     at MqttClient.emit (events.js:400:28)
  tuya-mqtt:error     at MqttClient._handlePublish (/opt/tuya-mqtt/node_modules/mqtt/lib                /client.js:1277:12)
  tuya-mqtt:error     at MqttClient._handlePacket (/opt/tuya-mqtt/node_modules/mqtt/lib/                client.js:410:12)
  tuya-mqtt:error     at work (/opt/tuya-mqtt/node_modules/mqtt/lib/client.js:321:12)
  tuya-mqtt:error     at Writable.writable._write (/opt/tuya-mqtt/node_modules/mqtt/lib/                client.js:335:5)
  tuya-mqtt:error     at doWrite (/opt/tuya-mqtt/node_modules/readable-stream/lib/_strea                m_writable.js:409:139)
  tuya-mqtt:error     at writeOrBuffer (/opt/tuya-mqtt/node_modules/readable-stream/lib/                _stream_writable.js:398:5)
  tuya-mqtt:error     at Writable.write (/opt/tuya-mqtt/node_modules/readable-stream/lib                /_stream_writable.js:307:11)
  tuya-mqtt:error     at Socket.ondata (internal/streams/readable.js:731:22) +0ms

Problem solved! Tuya-cli wizard asks at the beginning for a virtual ID.
Did not realize that this is the actual ID of the device I have…So I was looking for that kind of ID in the Tuya cloud and copied some other ID.
When I used the devices ID everything worked like charm. I already have
two items working smoothly in OH. The other ones shall be born tomorrow. Thanks a lot!

Hi everyone. I am new to the forum and just got started with openhab. I managed to add a Sony projector and air conditioners from Mitsubishi, but cannot nderstand how to add binders like the ones found on github.
I also have several appliencies using Tuya and have gone found the link mentioned in a previous post addons/bundles/org.smarthomej.binding.tuya at 3.2.x · smarthomej/addons · GitHub Is any one so kind to explain how I import the files into openHab?
I am running openHab on a Qnap server in docker. Not sure if this will influence the procedure.
Thanks to anyone that can help.

@Norixone you can add the Smarthome/J bindings through the openHAB UI as discussed at GitHub - smarthomej/addons: SmartHome/J addons for openHAB. Follow the instructions under Installation/Usage. After you enter the required JSON 3rd party add on service


the Smarthome/J bindings will appear below the Community Marketplace entries on the main Bindings page.

Hope this helps.

@BigGeorgeTx that is the fastest reply I haver received on a forum. Thank you. I actually did that, but was not seeing the Tuya binding, which I saw this morning. After reading your message I checked again my settings and there it was.

And now for the second dilemma. I am not seeing the Ewelin/Sonoff binding (openhab-3.x-sonoff/README.md at main · delid4ve/openhab-3.x-sonoff · GitHub). Any ideas on how to get that one?
Thank you so much for your help.

New question. I have managed to obtain all the necessary codes from the Tuya devices and was wondering if it is possible to simply install them manually as a generic tuya device. I have tried with the curtains, but does not seem to work as it states it is offline despite having the possibility to add the channels.
This is the result:

UID: tuya:tuyaDevice:beabcab9c9
label: Home Theater Screen
thingTypeUID: tuya:tuyaDevice
configuration:
pollingInterval: 0
protocol: “3.3”
productId: XS76BY5Q1uKO6gjC
deviceId: “58344787500291590328”
ip: 192.168.2.252
localKey: 35778709a8a8f0a1
location: Home Theater
channels:

  • id: opposite
    channelTypeUID: tuya:switch
    label: opposite
    description: null
    configuration:
    dp: 103
  • id: position
    channelTypeUID: tuya:number
    label: position
    description: null
    configuration:
    dp: 101
    max: 100
    min: 0
  • id: mach_operate
    channelTypeUID: tuya:string
    label: mach_operate
    description: null
    configuration:
    dp: 102
    range: ZZ,FZ,STOP

Am I doing something wrong or it is simply not possible to add Tuya devices this way?

OK solved. I had MAC filtering on my WIFI that was stopping openHab from connecting.

I am having an issue with HTTP binding. I have managed to get the Tuya scenes working through IFTT, but the scenes go into a loop. I have one sequence to turn off the lights and another one to turn them back on.
Any ideas how to solve this? I have tried by setting to seperate switches to trigger the sequence and then having them both on the same switch.