[
{
"id": "e72a13ae9e87116b",
"type": "tab",
"label": "Auto Check TV",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f1bcc932a71348f3",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": true,
"heartbeatInterval": 30,
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": ": ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "default",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": true
},
{
"id": "4aaff77571386409",
"type": "api-call-service",
"z": "e72a13ae9e87116b",
"name": "Turn off - TV",
"server": "f1bcc932a71348f3",
"version": 7,
"debugenabled": false,
"action": "media_player.turn_off",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"media_player.sony_xr_55x91j"
],
"labelId": [],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": true,
"domain": "media_player",
"service": "turn_off",
"x": 610,
"y": 200,
"wires": [
[]
]
},
{
"id": "049a206b6a3aad13",
"type": "function",
"z": "e72a13ae9e87116b",
"name": "Check",
"func": "\nif( flow.get("isForceOff") === undefined){\n flow.set("isForceOff",false);\n// node.warn("检测: 强制关闭电视已经置为'否'");\n}\n\nif(flow.get("isForceOff")==false){\n msg.payload = true;\n// node.warn("检测: 允许开启电视");\n} else {\n msg.payload = false;\n// node.warn("检测: 不允许开启电视");\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 160,
"wires": [
[
"e667612bfbc34390"
]
]
},
{
"id": "e667612bfbc34390",
"type": "switch",
"z": "e72a13ae9e87116b",
"name": "Payload",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 400,
"y": 120,
"wires": [
[
"90575e4f1dedc685"
],
[
"4aaff77571386409"
]
]
},
{
"id": "d2d8cc09d4170b43",
"type": "function",
"z": "e72a13ae9e87116b",
"name": "Reset",
"func": "\nif(flow.get("isForceOff")){\n flow.set("isForceOff",false);\n node.warn("重置: 强制关闭电视已经置为'否'");\n}",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 910,
"y": 280,
"wires": [
[]
]
},
{
"id": "33bae3b5f5f91286",
"type": "function",
"z": "e72a13ae9e87116b",
"name": "Retest",
"func": "if( flow.get("isForceOff") === undefined){\n flow.set("isForceOff",true);\n}\n\nif(flow.get("isForceOff")==false){\n msg.payload = true;\n// node.warn("复验: 允许再次开启电视");\n} else {\n msg.payload = false;\n// node.warn("复验: 暂不允许开启电视,需再次等待20分钟");\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 240,
"wires": [
[
"3c4b231196671ca1"
]
]
},
{
"id": "15cab9ddbb157d92",
"type": "function",
"z": "e72a13ae9e87116b",
"name": "Set",
"func": "\nif(flow.get("isForceOff")==false){\n flow.set("isForceOff",true);\n msg.payload = false;\n node.warn("设置: 强制关闭电视已经置为'是'");\n}\n\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 930,
"y": 120,
"wires": [
[
"1e80f6515b60622f"
]
]
},
{
"id": "3c4b231196671ca1",
"type": "switch",
"z": "e72a13ae9e87116b",
"name": "Payload",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 400,
"y": 280,
"wires": [
[
"3df548d33c309f45",
"6d72c3758c3f7756"
]
]
},
{
"id": "e804949e5d09f2dc",
"type": "switch",
"z": "e72a13ae9e87116b",
"name": "Payload",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 760,
"y": 280,
"wires": [
[
"d2d8cc09d4170b43"
]
]
},
{
"id": "1044ded30ce37fa3",
"type": "switch",
"z": "e72a13ae9e87116b",
"name": "Payload",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 760,
"y": 120,
"wires": [
[
"15cab9ddbb157d92"
]
]
},
{
"id": "6db3aa6920ddf0d0",
"type": "poll-state",
"z": "e72a13ae9e87116b",
"name": "TV State",
"server": "f1bcc932a71348f3",
"version": 3,
"exposeAsEntityConfig": "",
"updateInterval": "5",
"updateIntervalType": "num",
"updateIntervalUnits": "seconds",
"outputInitially": false,
"outputOnChanged": false,
"entityId": "media_player.sony_xr_55x91j",
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputs": 2,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 80,
"y": 120,
"wires": [
[
"049a206b6a3aad13"
],
[
"33bae3b5f5f91286"
]
]
},
{
"id": "1e80f6515b60622f",
"type": "api-call-service",
"z": "e72a13ae9e87116b",
"name": "Turn off - TV",
"server": "f1bcc932a71348f3",
"version": 7,
"debugenabled": false,
"action": "media_player.turn_off",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"media_player.sony_xr_55x91j"
],
"labelId": [],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": true,
"domain": "media_player",
"service": "turn_off",
"x": 890,
"y": 180,
"wires": [
[]
]
},
{
"id": "3df548d33c309f45",
"type": "api-call-service",
"z": "e72a13ae9e87116b",
"name": "Turn off - TV",
"server": "f1bcc932a71348f3",
"version": 7,
"debugenabled": false,
"action": "media_player.turn_off",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"media_player.sony_xr_55x91j"
],
"labelId": [],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": true,
"domain": "media_player",
"service": "turn_off",
"x": 610,
"y": 340,
"wires": [
[]
]
},
{
"id": "90575e4f1dedc685",
"type": "trigger",
"z": "e72a13ae9e87116b",
"name": "Wait 45 Min",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "45",
"extend": false,
"overrideDelay": false,
"units": "min",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 590,
"y": 120,
"wires": [
[
"1044ded30ce37fa3"
]
]
},
{
"id": "6d72c3758c3f7756",
"type": "trigger",
"z": "e72a13ae9e87116b",
"name": "Wait 20 Min",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "20",
"extend": false,
"overrideDelay": false,
"units": "min",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 590,
"y": 280,
"wires": [
[
"e804949e5d09f2dc"
]
]
}
]
希望有大神能帮忙完善,感谢。