# Linking tuya web platform devices

**URL:** <https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341>\
**Category:** General\
**Created:** [26 November 2021 15:30 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341 "2021-11-26T15:30:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![LHPDM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lhpdm/32/51640_2.png) [@LHPDM](https://discourse.nodered.org/u/LHPDM)\
**Post date:** [26 November 2021 15:30 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/1 "2021-11-26T15:30:11Z")

</div>

I'm using the node-red-contrib-homebridge-automation since month. in the last days I can switch with the hb-control node the lights on and off, but if someone switches the light at the switch, over home bridge or HomeKit, the status change does not arrive node red. the status is the whole time "0".

in former times I could read the status with the hb-status node.  
how can I make it work again or even better, how can I directly read the status of Tuya web platform devices? in home bridge it works without problems, but I couldn't find a palette, which does the same in node red, so I chose last year the home bridge automation palette

who has a tipp for me?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 November 2021 00:21 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/2 "2021-11-27T00:21:14Z")

</div>

I use those things I think. (Or `TASMOTA`... I don't quite get all the names)

But maybe you need to monitor the `power` messages in/on `MQTT` and set the message controls the state shown.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [27 November 2021 01:10 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/3 "2021-11-27T01:10:33Z")

</div>

I use the `node-red-contrib-tuya-smart-device` to control my Tuya devices. There are a few hoops to jump through to get it working but once going works well.

---

<div class="post-metadata">

**Author:** ![LHPDM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lhpdm/32/51640_2.png) [@LHPDM](https://discourse.nodered.org/u/LHPDM)\
**Post date:** [27 November 2021 11:10 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/4 "2021-11-27T11:10:06Z")

</div>

MQTT would be so nice, but these Tuya device I couldn’t change to tasmota. So I need a solution over Homebridge or node red to get the power status. With that I will bring it into mqtt and can use my light steering again.

---

<div class="post-metadata">

**Author:** ![LHPDM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lhpdm/32/51640_2.png) [@LHPDM](https://discourse.nodered.org/u/LHPDM)\
**Post date:** [27 November 2021 11:13 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/5 "2021-11-27T11:13:27Z")

</div>

> [@Buckskin](#):
>
> I use the `node-red-contrib-tuya-smart-device` to control my Tuya devices. There are a few hoops to jump through to get it working but once going works well.

Thanks for replying. I have a linked iot app linked in Homebridge. An there it works. But if I look at the iot site, there are no linked devices.

I hope I will get it running again in node red.

Do you got a good explanation or YouTube video source for it?

---

<div class="post-metadata">

**Author:** ![LHPDM](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lhpdm/32/51640_2.png) [@LHPDM](https://discourse.nodered.org/u/LHPDM)\
**Post date:** [27 November 2021 21:11 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/6 "2021-11-27T21:11:26Z")

</div>

> [@Buckskin](#):
>
> I use the `node-red-contrib-tuya-smart-device` to control my Tuya devices. There are a few hoops to jump through to get it working but once going works well.

Hey Buckskin,

Now I got the ids and keys for my Tuya devices, but I can’t get it running. What do you insert in the inject node to get the status of my switch out?

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [28 November 2021 00:42 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/7 "2021-11-28T00:42:31Z")

</div>

Depends on the device but this is a short section of an old function node that does that does the trick;

```auto
    // Get device current status (Normally only at STARTUP). Note operation === "SET" is default
    if (operation === "GET") {
        msg.payload = {dps: command_dps, operation: 'get'};

    } else {
        msg.payload = {dps: command_dps, set: command_value};

    }

```

So to turn on my light the inject node `msg.payload` would be set to JSON and `{"dps": 20, "set": true}`  
To get the status of a device, in this case a power socket, the payload should be set to `{"dps":1,"operation": "get"}`. The dps can vary dependant on the device (for the status of a light for example the dps is 20)

If you have been using the device previously then presumably you have the `dps codes` for the various attributes of the device.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 January 2022 00:42 UTC](https://discourse.nodered.org/t/linking-tuya-web-platform-devices/54341/8 "2022-01-27T00:42:58Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
