Skip to content

Instantly share code, notes, and snippets.

@TheGroundZero
Created January 27, 2021 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheGroundZero/3010d48231e0a36828e75e7866bdbe41 to your computer and use it in GitHub Desktop.
Save TheGroundZero/3010d48231e0a36828e75e7866bdbe41 to your computer and use it in GitHub Desktop.
Node-RED Notify sub-flow
[{
"id": "cb290db1.265c48",
"type": "subflow",
"name": "Notify",
"info": "",
"category": "",
"in": [{
"x": 40,
"y": 100,
"wires": [{
"id": "2b33c8d6.f3f188"
}
]
}
],
"out": [],
"env": [{
"name": "who",
"type": "str",
"value": "all",
"ui": {
"icon": "font-awesome/fa-user",
"label": {
"en-US": "Who?"
},
"type": "input",
"opts": {
"types": ["str"]
}
}
}, {
"name": "home",
"type": "bool",
"value": "true",
"ui": {
"icon": "font-awesome/fa-home",
"label": {
"en-US": "Check @Home"
},
"type": "input",
"opts": {
"types": ["bool"]
}
}
}
],
"color": "#DDAA99",
"status": {
"x": 1080,
"y": 160,
"wires": [{
"id": "b70c09de.cac7",
"port": 0
}
]
}
}, {
"id": "2b33c8d6.f3f188",
"type": "switch",
"z": "cb290db1.265c48",
"name": "",
"property": "who",
"propertyType": "env",
"rules": [{
"t": "eq",
"v": "Person X",
"vt": "str"
}, {
"t": "eq",
"v": "Person Y",
"vt": "str"
}, {
"t": "eq",
"v": "tablet",
"vt": "str"
}, {
"t": "eq",
"v": "TTS",
"vt": "str"
}, {
"t": "eq",
"v": "all-noTTS",
"vt": "str"
}, {
"t": "eq",
"v": "all",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 6,
"x": 150,
"y": 100,
"wires": [["3e1659e9.517eae"], ["b891a683.46b5a"], ["ff2194d5.887128"], ["b7860109.a6e758"], ["3e1659e9.517eae", "b891a683.46b5a", "ff2194d5.887128"], ["ff2194d5.887128", "b891a683.46b5a", "3e1659e9.517eae", "b7860109.a6e758"]]
}, {
"id": "3e1659e9.517eae",
"type": "template",
"z": "cb290db1.265c48",
"name": "Person X",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"domain\": \"notify\",\n \"service\": \"mobile_app_device_x\",\n \"entity_id\": \"person.x\",\n \"data\" : {\n \"title\": \"{{payload.data.title}}\",\n \"message\": \"{{payload.data.message}}\"\n }\n}",
"output": "json",
"x": 400,
"y": 40,
"wires": [["5b00911c.f13bf8"]]
}, {
"id": "b891a683.46b5a",
"type": "template",
"z": "cb290db1.265c48",
"name": "Person Y",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"domain\": \"notify\",\n \"service\": \"mobile_app_device_y\",\n \"entity_id\": \"person.y\",\n \"data\" : {\n \"title\": \"{{payload.data.title}}\",\n \"message\": \"{{payload.data.message}}\"\n }\n}",
"output": "json",
"x": 400,
"y": 100,
"wires": [["5b00911c.f13bf8"]]
}, {
"id": "ff2194d5.887128",
"type": "template",
"z": "cb290db1.265c48",
"name": "Tablet",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"domain\": \"notify\",\n \"service\": \"mobile_app_tablet\",\n \"entity_id\": \"device_tracker.tablet_app\",\n \"data\" : {\n \"title\": \"{{payload.data.title}}\",\n \"message\": \"{{payload.data.message}}\"\n }\n}",
"output": "json",
"x": 390,
"y": 160,
"wires": [["5b00911c.f13bf8"]]
}, {
"id": "b70c09de.cac7",
"type": "api-call-service",
"z": "cb290db1.265c48",
"name": "Notify",
"server": "2ce15169.23b9de",
"version": 1,
"debugenabled": false,
"service_domain": "",
"service": "",
"entityId": "",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 930,
"y": 100,
"wires": [[]]
}, {
"id": "bd402f12.b2177",
"type": "api-current-state",
"z": "cb290db1.265c48",
"name": "Home?",
"server": "2ce15169.23b9de",
"version": 1,
"outputs": 2,
"halt_if": "home",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "",
"state_type": "str",
"state_location": "",
"override_payload": "none",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 800,
"y": 60,
"wires": [["b70c09de.cac7"], []]
}, {
"id": "5b00911c.f13bf8",
"type": "switch",
"z": "cb290db1.265c48",
"name": "Check @Home?",
"property": "home",
"propertyType": "env",
"rules": [{
"t": "true"
}, {
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 640,
"y": 100,
"wires": [["bd402f12.b2177"], ["b70c09de.cac7"]]
}, {
"id": "b7860109.a6e758",
"type": "template",
"z": "cb290db1.265c48",
"name": "Rhasspy",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"data\": {\n \"message\": \"{{payload.data.message}}\"\n }\n}",
"output": "json",
"x": 400,
"y": 220,
"wires": [[]]
}, {
"id": "2ce15169.23b9de",
"type": "server",
"name": "Home Assistant",
"legacy": false,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment