Code: Select all
[
{
"id": "a36df463ae2177b1",
"type": "tab",
"label": "Test Tuya",
"disabled": false,
"info": "",
"env": []
},
{
"id": "60ada4c9e2935d7e",
"type": "inject",
"z": "a36df463ae2177b1",
"name": "22",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{ \"data\": {\"dps\": {\"22\": 368, \"t\": 1739718165}}}",
"payloadType": "json",
"x": 730,
"y": 360,
"wires": [
[
"e98ffbd91e8e474e"
]
]
},
{
"id": "88c897f6d4d2ae3e",
"type": "inject",
"z": "a36df463ae2177b1",
"name": "18",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{ \"data\": {\"dps\": {\"18\": 207, \"t\": 1739718392}}}",
"payloadType": "json",
"x": 730,
"y": 440,
"wires": [
[
"e98ffbd91e8e474e"
]
]
},
{
"id": "e98ffbd91e8e474e",
"type": "switch",
"z": "a36df463ae2177b1",
"name": "",
"property": "payload.data.dps",
"propertyType": "msg",
"rules": [
{
"t": "hask",
"v": "22",
"vt": "str"
},
{
"t": "hask",
"v": "18",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 890,
"y": 400,
"wires": [
[
"8d3608fdd71ba935",
"20693e810e15f159"
],
[
"97e0bbfe6024e72a",
"7bfa0993f3e68360"
]
]
},
{
"id": "8d3608fdd71ba935",
"type": "debug",
"z": "a36df463ae2177b1",
"name": "debug 7",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1040,
"y": 320,
"wires": []
},
{
"id": "97e0bbfe6024e72a",
"type": "debug",
"z": "a36df463ae2177b1",
"name": "debug 8",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1040,
"y": 480,
"wires": []
},
{
"id": "4225e5fa4b8ee092",
"type": "debug",
"z": "a36df463ae2177b1",
"name": "debug 9",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1260,
"y": 400,
"wires": []
},
{
"id": "20693e810e15f159",
"type": "function",
"z": "a36df463ae2177b1",
"name": "function 2",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 123, \"nvalue\": 0, \"svalue\": msg.payload.data.dps[\"22\"]}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1040,
"y": 380,
"wires": [
[
"4225e5fa4b8ee092"
]
]
},
{
"id": "7bfa0993f3e68360",
"type": "function",
"z": "a36df463ae2177b1",
"name": "function 3",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 456, \"nvalue\": 0, \"svalue\": msg.payload.data.dps[\"18\"]}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1040,
"y": 420,
"wires": [
[
"4225e5fa4b8ee092"
]
]
}
]
Do the following.
1. For each sensor (with a number) add an extra output in the "Switch node
2. In the first line of the "Function" node insert the correct Domoticz IDX number
3. Replace the last Debug node with your own "MQTT Output" node.
Let me know, if this example helps.