Step-by-Step guide for adding Tuya-bulbs, Wi-Fi smart LED (Smart Life app) to OH2 using tuya-mqtt.js by AgentK

Hi @worstenbrood nice writing… I use textual config and an external mqtt broker, but have managed to get everything configured so far… I only have one question maybe you can answer this?!
in your guide you add two channels:

• Mode (switch)
   Command: tuya/lsc-a60-rgb-cct_1/dps/21/command
   State: tuya/lsc-a60-rgb-cct_1/dps/21/state
   Off value: colour
   On value: white
   Has another value: scene

• Scene (string)
  State: tuya/lsc-a60-rgb-cct_1/dps/25/state
  Command: tuya/lsc-a60-rgb-cct_1/dps/25/command 

this looks like this in my textual config:

            Type switch : mode "Mode" [
                stateTopic="tuya/Smart-Bulb_01/dps/21/state",
                commandTopic="tuya/Smart-Bulb_01/dps/21/command",
                On="white",
                Off="colour"
            ]
            Type string : scene "Color Scene" [
                stateTopic="tuya/Smart-Bulb_01/dps/25/state",
                commandTopic="tuya/Smart-Bulb_01/dps/25/command"
            ]

but what is missing is the linking to the scene channel…

   Has another value: scene

any idea how this would look like in textual config?

I had a look at the Documentation but this doesn’t seem to cover how to link these channels in text files.

Is this neccesary at all? Would be nice to get my tuya bulbs controlled by openhab :wink:

thanks

Edit:
Ok, I got everything running without the channel linking… no problem for me because I don’t use these preconfigured tuya lightscenes at all.

Hi All, new to this thread but not to Openhab. Just trying to integrate Tuya into my system - and this is the 3rd method I’ve tried :wink:

I’m so close with this one! But I think my issue is that I have all my devices behind a Tuya hub. So the only device with wifi is the hub itself, my other devices need the hub to access wifi.

Anyone know of a way to get to those sub-devices using this method. I’ve tried accessing them directly, and also most recently found a potential protocol for referencing sub-devices via the gateway for another API tuyaDAEMOM global.alldevices · msillano/tuyaDAEMON Wiki · GitHub

So I was trying…

[
  {
    name: 'Zigbee Hub',
    id: 'hhhhhhhhh',
    key: 'kkkkkkkkkk1',
    subDevices: [
      {
        name: 'Pool Blind 2',
        id: 'bbbbbbbbbbbb',
        gateway: 'hhhhhhhhh',
        cid: 'id1ididididididid'
      },
      {
        name: 'LED Strip',
        id: 'bf78XXXXXXXXXtws',
        gateway: 'hhhhhhhhh',
        cid: 'id2ididididididididi'
      }
    ]
  }
]

The hub is connecting fine, but the sub-devices just time-out. Should i just give up on this one? Next step i think is to Flash the Zigbee devices!

Are these actually Tuya or Zigbee devices? I know there are Tuya devices out there which aditionally use the Zigbee standard. If that is the case, aren’t you able to use a Zigbee-Bridge and get rid of that Tuya crap?? I thought if devices (even tuya) are able to use the Zigbee standard you don’t have to use the Smartlife App.

…btw, never heard of a tuya-bridge, are you sure you’re not using a Zigbee-bridge?

Just a guess but if this is the case you should be able to use it with the Zigbee-Binding if I’m not mistaking…

I’m not sure if this works

The devices have Tuya/Zigbee logos on the boxes. The hub is a cheap one from Amazon, says Zigbee 3.0 Hub, but has Zigbee and Tuya logos all over it - the brand is Yueyang.

Think this is a pretty standard Zigbee 3.0 hub? (sorry I see Amazon link says ‘door sensor’ but that’s just one of the items you can buy in this listing - also can buy the hub)

I have tried the Zigbee binding, but this needs a Zigbee co-ordinator USB dongle in my RPI. I purchased the Sonoff Zigbee 3.0 Plus dongle. Had some success, but the singnal was really weak around my house, so not sure if its going to work for me without buying loads of smart plugs or something similar to boost the signal.

Yeah that’s the downside of the low energy zigbee devices… all battery powered devices have a lack of range and can’t be used as mesh extenders. So you’re right, without using direct powered devices there are no extenders in your setup.

Sorry, can’t help with the Tuya Subdevice configuration…

Edit:
I don’t know if you like some electro-tinkering but if so maybe this link is something for you to inexpensively extend your zigbee-mesh.

There are a few similar projects out there… so maybe you find a solution that satisfies your needs…

Even the picture scared me :wink: I’m actually thinking of going a slightly different route. My main reason for looking at Zigbee/Tuya was for roller-blinds. Have got a couple of Zemismart Zigbee blinds from China - but they are also RF. So for 20euro I’m going to try a Sonoff RF to WiFi converter.

If I can get this working I can then use something like MQTT to instruct as per the below.

The RF signals are pretty reliable in these blinds and I have the RF remote to learn the commands - if i can get this working i can rid myself of Zigbee and Tuya alltogether!

Describe the bug
Hi, im currently on raspberry pi and using OpenHab.
I have setup the tuya-mqtt in my folder /opt/tuya-mqtt.
The Pi creates a hotspot with Hostapd via WiFi.
He only gets internet access when I connect him to the Ethernet (it’s all supposed to be like that, so it’s correct).
My Tuya Bulb then connects to the hotspot and can also be pinged.
The MQTT-Broker and my LED are already setup and working. → See config file
I have downloaded mqtt-explorer to track the trafic on my broker topic and noticed that every time I connect my Raspberry pi to the Internet, a topic called “Homeassistant” and several subtopics are created.
I also noticed that my LED only works when the mentioned topics are created and the status is = online…
If the status = offline, the LED cannot be controlled or pinged.
It should be mentioned that the pi creates the mentioned topics after booting and after that the status goes online for several seconds. (LED can be controlled during this time without any problems)
The status then goes offline again and the LED cannot be controlled.
Important: Only if the Pi had Internet access while booting up it will create the topics!

Expected behavior
The problem is that I actually want to control the LED completely locally and without any internet access.
When booting up, the LED should be easily controlled.

Screenshots

Versions:

  • Raspbian debian buster v. 10
  • OpenHab 2.5.8
  • MQTT 2.5.8

Additional context
Maybe someone can tell me if the port (1884) is correct or whether there is a specific port that is used for the Broker.
Also, it would be nice if someone could tell me what the status stands for and if it’s normal for me to need an internet connection while booting the Pi.

Thanks for your help!

@Dan sorry for the late reply but i switched to HA in the mean time. The values of the scenes (like you can see if you run tuya-mqqt in debug and use the official app to switch) are some hexadecimal values i didn’t spend time on to decode.