[
{
"id": "623357d2e876ab06",
"type": "subflow",
"name": "巴法连HA",
"info": "",
"category": "",
"in": [
{
"x": 120,
"y": 20,
"wires": [
{
"id": "1a6a667787f70d88"
}
]
}
],
"out": [
{
"x": 720,
"y": 40,
"wires": [
{
"id": "ff32644de77c30c0",
"port": 0
},
{
"id": "ff32644de77c30c0",
"port": 1
}
]
}
],
"env": [
{
"name": "entity_id",
"type": "str",
"value": "entity001"
},
{
"name": "mqtttopic",
"type": "str",
"value": "test001"
}
],
"meta": {},
"color": "#C7E9C0",
"icon": "node-red-contrib-home-assistant-websocket/ha-webhook.svg"
},
{
"id": "dffd385bea936724",
"type": "mqtt in",
"z": "623357d2e876ab06",
"name": "",
"topic": "${mqtttopic}",
"qos": "2",
"datatype": "auto",
"broker": "51136551f880e3a0",
"nl": false,
"rap": true,
"rh": 0,
"x": 390,
"y": 140,
"wires": [
[
"ff32644de77c30c0"
]
]
},
{
"id": "1a6a667787f70d88",
"type": "mqtt out",
"z": "623357d2e876ab06",
"name": "",
"topic": "${mqtttopic}",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "51136551f880e3a0",
"x": 390,
"y": 80,
"wires": []
},
{
"id": "de3535e203dd44dd",
"type": "server-state-changed",
"z": "623357d2e876ab06",
"name": "次卧主灯",
"server": "3df55419.f637dc",
"version": 3,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "${entity_id}",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": true,
"for": 0,
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 200,
"y": 80,
"wires": [
[
"1a6a667787f70d88"
]
]
},
{
"id": "25a18cb6126e4b46",
"type": "api-call-service",
"z": "623357d2e876ab06",
"name": "",
"server": "3df55419.f637dc",
"version": 3,
"debugenabled": false,
"service_domain": "switch",
"service": "turn_on",
"entityId": "${entity_id}",
"data": "",
"dataType": "jsonata",
"mergecontext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 770,
"y": 120,
"wires": [
[]
]
},
{
"id": "ff32644de77c30c0",
"type": "switch",
"z": "623357d2e876ab06",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 570,
"y": 140,
"wires": [
[
"25a18cb6126e4b46"
],
[
"d487c7df9f5b9f5c"
]
]
},
{
"id": "d487c7df9f5b9f5c",
"type": "api-call-service",
"z": "623357d2e876ab06",
"name": "",
"server": "3df55419.f637dc",
"version": 3,
"debugenabled": false,
"service_domain": "switch",
"service": "turn_off",
"entityId": "${entity_id}",
"data": "",
"dataType": "jsonata",
"mergecontext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 770,
"y": 180,
"wires": [
[]
]
},
{
"id": "51136551f880e3a0",
"type": "mqtt-broker",
"name": "巴法云",
"broker": "bemfa.com",
"port": "9501",
"clientid": "",
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
},
{
"id": "3df55419.f637dc",
"type": "server",
"name": "Home Assistant",
"version": 1,
"legacy": false,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": false
},
{
"id": "ac6aa2263f7c09d2",
"type": "subflow:623357d2e876ab06",
"z": "9f7bc6d2.1403b8",
"name": "次卧主灯",
"env": [
{
"name": "entity_id",
"value": "switch.0x001",
"type": "str"
},
{
"name": "mqtttopic",
"value": "ciwozhudeng001",
"type": "str"
}
],
"x": 480,
"y": 500,
"wires": [
[
"f242529bdbe3b3ca"
]
]
},
{
"id": "25535accd358b15d",
"type": "inject",
"z": "9f7bc6d2.1403b8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "on",
"payloadType": "str",
"x": 240,
"y": 480,
"wires": [
[
"ac6aa2263f7c09d2"
]
]
},
{
"id": "aff08f1e5531f3ec",
"type": "inject",
"z": "9f7bc6d2.1403b8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "off",
"payloadType": "str",
"x": 250,
"y": 520,
"wires": [
[
"ac6aa2263f7c09d2"
]
]
},
{
"id": "f242529bdbe3b3ca",
"type": "debug",
"z": "9f7bc6d2.1403b8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 500,
"wires": []
}
]