[
{
"id": "b2e04683.825318",
"type": "tab",
"label": "Example Flow",
"disabled": false,
"info": ""
},
{
"id": "e63245d0.e6cdc8",
"type": "tuya-smart-device",
"z": "b2e04683.825318",
"deviceName": "Tv Light",
"disableAutoStart": true,
"deviceId": "",
"deviceKey": "",
"storeAsCreds": false,
"deviceIp": "",
"retryTimeout": "1001",
"findTimeout": "2000",
"tuyaVersion": "3.1",
"eventMode": "event-both",
"x": 680,
"y": 360,
"wires": [
[
"ff4bd686.53ae18"
],
[
"15d22ba6.824b84"
]
]
},
{
"id": "c016131.e98faf",
"type": "function",
"z": "b2e04683.825318",
"name": "",
"func": "msg.payload ={\n //dps : 1,\n dps: 20,\n set : msg.payload\n}\n\n/*\n\n */\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 510,
"y": 360,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "993c8470.01a278",
"type": "inject",
"z": "b2e04683.825318",
"name": "Turn On",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 310,
"y": 320,
"wires": [
[
"c016131.e98faf"
]
]
},
{
"id": "6403cde.251ab34",
"type": "inject",
"z": "b2e04683.825318",
"name": "Turn Off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 310,
"y": 400,
"wires": [
[
"c016131.e98faf"
]
]
},
{
"id": "e4cfcdc.9520a3",
"type": "tuya-smart-device-generic",
"z": "b2e04683.825318",
"name": "",
"eventMode": "event-both",
"x": 660,
"y": 740,
"wires": [
[
"1e77cd28.a8c303"
]
]
},
{
"id": "81a451cc.919f9",
"type": "function",
"z": "b2e04683.825318",
"name": "",
"func": "msg.payload ={\n \"deviceVirtualId\": \"\",\n //deviceIp: \"192.168.1.71\",\n \"deviceKey\": \"\",\n \"deviceName\": \"PM\",\n \"operation\": \"SET\", // optional default : SET\n \"payload\": {\n \"dps\": 20,\n \"set\": msg.payload\n },\n // \"version\":\"3.2\"\n \n }\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 450,
"y": 740,
"wires": [
[
"e4cfcdc.9520a3"
]
]
},
{
"id": "dc28dca8.674c1",
"type": "inject",
"z": "b2e04683.825318",
"name": "ON",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 240,
"y": 780,
"wires": [
[
"81a451cc.919f9"
]
]
},
{
"id": "1e77cd28.a8c303",
"type": "debug",
"z": "b2e04683.825318",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 940,
"y": 740,
"wires": []
},
{
"id": "4295327a.09bf3c",
"type": "inject",
"z": "b2e04683.825318",
"name": "OFF",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 240,
"y": 700,
"wires": [
[
"81a451cc.919f9"
]
]
},
{
"id": "8f69fe68.9e4ce",
"type": "catch",
"z": "b2e04683.825318",
"name": "",
"scope": null,
"uncaught": false,
"x": 640,
"y": 140,
"wires": [
[
"3764c769.6e1298"
]
]
},
{
"id": "3764c769.6e1298",
"type": "debug",
"z": "b2e04683.825318",
"name": "On Error",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 140,
"wires": []
},
{
"id": "ff4bd686.53ae18",
"type": "debug",
"z": "b2e04683.825318",
"name": "Device Data",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 300,
"wires": []
},
{
"id": "15d22ba6.824b84",
"type": "debug",
"z": "b2e04683.825318",
"name": "Node State",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 400,
"wires": []
},
{
"id": "47ea1d2a.7d85f4",
"type": "inject",
"z": "b2e04683.825318",
"name": "RECONNECT ACTION",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"RECONNECT\"}",
"payloadType": "json",
"x": 340,
"y": 260,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "1991e72.c15c719",
"type": "inject",
"z": "b2e04683.825318",
"name": "DISCONNECT ACTION",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"DISCONNECT\"}",
"payloadType": "json",
"x": 340,
"y": 200,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "c820897454429637",
"type": "inject",
"z": "b2e04683.825318",
"name": "Get Schema",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"GET\",\"schema\":true}",
"payloadType": "json",
"x": 310,
"y": 100,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "7b416b83a6edfd2b",
"type": "inject",
"z": "b2e04683.825318",
"name": "Get Status of dps 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"GET\" , \"dps\": 1}",
"payloadType": "json",
"x": 330,
"y": 40,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "8616fca1bda4ddbf",
"type": "inject",
"z": "b2e04683.825318",
"name": "SET EVENT MODE - DATA",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_EVENT_MODE\",\"value\":\"event-data\"}",
"payloadType": "json",
"x": 260,
"y": 460,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "cbe30d8393fbb66a",
"type": "inject",
"z": "b2e04683.825318",
"name": "SET EVENT MODE - DP REFRESH",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_EVENT_MODE\",\"value\":\"event-dp-refresh\"}",
"payloadType": "json",
"x": 280,
"y": 500,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "4df579385b195b55",
"type": "inject",
"z": "b2e04683.825318",
"name": "Update Find Timeout",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_FIND_TIMEOUT\",\"value\":1234}",
"payloadType": "json",
"x": 230,
"y": 540,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "65ab15b279337d86",
"type": "inject",
"z": "b2e04683.825318",
"name": "Update Retry Timeout",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_RETRY_TIMEOUT\",\"value\":1234}",
"payloadType": "json",
"x": 240,
"y": 580,
"wires": [
[
"e63245d0.e6cdc8"
]
]
},
{
"id": "51d98c1b9e3ce54b",
"type": "inject",
"z": "b2e04683.825318",
"name": "CONNECT ACTION",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"operation\":\"CONTROL\",\"action\":\"CONNECT\"}",
"payloadType": "json",
"x": 330,
"y": 160,
"wires": [
[
"e63245d0.e6cdc8"
]
]
}
]