I have a tuya socket device and want to get the usage in domoticz
Cant find the solution maybe someone can help me?
This is the flow:
Code: Select all
[
{
"id": "34725c4ec27d40dd",
"type": "tab",
"label": "Tuya Koelkast",
"disabled": false,
"info": ""
},
{
"id": "24368e69f7b1414c",
"type": "tuya-local",
"z": "34725c4ec27d40dd",
"devName": "KoelKast",
"devIp": "192.168.2.160",
"devId": "48123468a4e57c1cfe2d",
"devKey": "n:]Kl1gqKfZ9||UA",
"protocolVer": "3.3",
"renameSchema": "",
"filterCB": "",
"x": 120,
"y": 100,
"wires": [
[
"82cc542778cd4923",
"d43deefd21f0a4b2"
]
]
},
{
"id": "466604012dd1ea0f",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 80,
"wires": []
},
{
"id": "45297eee97166e0c",
"type": "inject",
"z": "34725c4ec27d40dd",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "date",
"x": 80,
"y": 200,
"wires": [
[
"24368e69f7b1414c",
"82cc542778cd4923"
]
]
},
{
"id": "82cc542778cd4923",
"type": "switch",
"z": "34725c4ec27d40dd",
"name": "Dps",
"property": "payload.data.dps",
"propertyType": "msg",
"rules": [
{
"t": "hask",
"v": "1",
"vt": "str"
},
{
"t": "hask",
"v": "18",
"vt": "str"
},
{
"t": "hask",
"v": "19",
"vt": "str"
},
{
"t": "hask",
"v": "20",
"vt": "str"
},
{
"t": "hask",
"v": "21",
"vt": "str"
},
{
"t": "hask",
"v": "22",
"vt": "str"
},
{
"t": "hask",
"v": "23",
"vt": "str"
},
{
"t": "hask",
"v": "24",
"vt": "str"
},
{
"t": "hask",
"v": "25",
"vt": "str"
},
{
"t": "hask",
"v": "26",
"vt": "str"
},
{
"t": "hask",
"v": "27",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 11,
"x": 330,
"y": 120,
"wires": [
[
"466604012dd1ea0f"
],
[
"cdb888cd43869940"
],
[
"db0b1cbd58cc4b7a"
],
[
"539c6c5b1aba69f5",
"9c978c70306ceabe"
],
[
"4864ef0c2423fc50"
],
[
"386b879582c1203b"
],
[
"653f084179d38675"
],
[
"7aaba566f7f31dfc"
],
[
"d2873b8c185ef97a"
],
[
"639736d6b5157a4f"
],
[
"5e3f5352ea154487"
]
]
},
{
"id": "cdb888cd43869940",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "18 ",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 120,
"wires": []
},
{
"id": "db0b1cbd58cc4b7a",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "19 ",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 160,
"wires": []
},
{
"id": "d43deefd21f0a4b2",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "Alle dps",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 340,
"y": 320,
"wires": []
},
{
"id": "539c6c5b1aba69f5",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "20 ",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 200,
"wires": []
},
{
"id": "653f084179d38675",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "23",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 320,
"wires": []
},
{
"id": "4864ef0c2423fc50",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "21",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 240,
"wires": []
},
{
"id": "386b879582c1203b",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "22",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 280,
"wires": []
},
{
"id": "7aaba566f7f31dfc",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "24",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 360,
"wires": []
},
{
"id": "d2873b8c185ef97a",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "25",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 400,
"wires": []
},
{
"id": "3a3a274ee7fb793b",
"type": "comment",
"z": "34725c4ec27d40dd",
"name": "hier vangen we het dps nummer op en sturen we het naar het juiste idx in domoticz ",
"info": "hier vangen we het dps nummer op en sturen we het naar het juiste device nummer in domoticz",
"x": 630,
"y": 440,
"wires": []
},
{
"id": "d2ac8d01f90af68f",
"type": "mqtt out",
"z": "34725c4ec27d40dd",
"name": "To Domoticz",
"topic": "domoticz/in",
"qos": "0",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "f9f13036.e28b58",
"x": 990,
"y": 360,
"wires": []
},
{
"id": "fd7e93bfa3d6054c",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "Uitkomst",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1020,
"y": 100,
"wires": []
},
{
"id": "9c978c70306ceabe",
"type": "function",
"z": "34725c4ec27d40dd",
"name": "Function 4",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 2710, \"nvalue\": parseInt (msg.payload.data.dps[\"20\"]/10)}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 40,
"wires": [
[
"d2ac8d01f90af68f",
"fd7e93bfa3d6054c"
]
]
},
{
"id": "639736d6b5157a4f",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "26",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 480,
"wires": []
},
{
"id": "5e3f5352ea154487",
"type": "debug",
"z": "34725c4ec27d40dd",
"name": "27",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 520,
"wires": []
},
{
"id": "2bad7d3ed48f0d62",
"type": "function",
"z": "34725c4ec27d40dd",
"name": "",
"func": "\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 640,
"wires": [
[]
]
},
{
"id": "f9f13036.e28b58",
"type": "mqtt-broker",
"name": "127.0.0.1",
"broker": "127.0.0.1",
"port": "1883",
"clientid": "",
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
}
]
