vinodsr / node-red-contrib-tuya-smart-device

a node-red module for managing tuya smart devices
https://flows.nodered.org/node/node-red-contrib-tuya-smart-device
MIT License
43 stars 15 forks source link

cid output Zigbee Gateway #80

Closed hannoverRed closed 2 years ago

hannoverRed commented 2 years ago

Hello, everyone,

I can read the events when a lamp goes on or off. {"payload":{"data":{"dps":{"1":true},"cid":"XXXXXXXfffed77039","t":1647454814},"deviceId":"","deviceName":"Gateway Garten"},"_msgid":"ad756e10.6d4c1"}

Unfortunately, I can't turn it on from node red.

How can I control devices that come through a gateway.

LG Jörn

hannoverRed commented 2 years ago

Hello, everyone,

here is the solution for Zigbee devices that are trained on a gateway. solution

is the device one thing about

  1. Wifi is connected to Smart Life / Use Device ID
  2. Zigbee or Bluetooth device connected via Gatweway connected to Smart Life?

= Take IP address and KEY of the gateway and then see if you get an output with CID when you switch the device on and off manually. That would be the ID for the device behind a gateway.

"devId": msg.zDevice,   /// this is the ID that is output under CID for the device that is taught-in at the gateway.
"dps": "1",
"set": msg.payloadState

[ { "id": "9f754a7f.62a57", "type": "inject", "z": "81d48774.135ca8", "name": "Turn On", "props": [ { "p": "payloadState", "v": "true", "vt": "bool" }, { "p": "zDevice", "v": "588e81fffed77039", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 350, "y": 240, "wires": [ [ "fc7554c0.3fd498" ] ] }, { "id": "d1e0fee0.a1f3c", "type": "inject", "z": "81d48774.135ca8", "name": "Turn Off", "props": [ { "p": "payloadState", "v": "false", "vt": "bool" }, { "p": "zDevice", "v": "588e81fffed77039", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 350, "y": 320, "wires": [ [ "fc7554c0.3fd498" ] ] }, { "id": "fc7554c0.3fd498", "type": "function", "z": "81d48774.135ca8", "name": "", "func": "msg.payload ={\n \"devId\": msg.zDevice,\n \"dps\": \"1\",\n \"set\": msg.payloadState\n}\n\n/*\n\n */\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 520, "y": 280, "wires": [ [ "4ffedd79.c06d1c" ] ] }, { "id": "4ffedd79.c06d1c", "type": "tuya-smart-device", "z": "81d48774.135ca8", "deviceName": "Gateway Garten", "disableAutoStart": false, "deviceId": "", "deviceKey": "99XXXXXXXXXXXXXXed", "deviceIp": "192.168.XXX.XX", "retryTimeout": 1000, "findTimeout": 1000, "tuyaVersion": "3.1", "eventMode": "event-both", "x": 740, "y": 360, "wires": [ [], [] ] } ]