Emma door alert
This commit is contained in:
411
flows.json
411
flows.json
@ -1908,12 +1908,20 @@
|
||||
"b542615d3dee41f6",
|
||||
"fc25e2a837ec8229",
|
||||
"440fc7142e7345d4",
|
||||
"cef61cdb2808ce5a"
|
||||
"cef61cdb2808ce5a",
|
||||
"0367216416de8b4d",
|
||||
"03075516f3003707",
|
||||
"2e356bc6f1ad80dc",
|
||||
"c9d498c1e323b1e4",
|
||||
"f7bd6d5fabdba0e0",
|
||||
"515f7471cec7bce2",
|
||||
"ca85b450d07da81c",
|
||||
"40dae72402f8cdee"
|
||||
],
|
||||
"x": 894,
|
||||
"y": 739,
|
||||
"w": 612,
|
||||
"h": 262
|
||||
"x": 34,
|
||||
"y": 1139,
|
||||
"w": 812,
|
||||
"h": 442
|
||||
},
|
||||
{
|
||||
"id": "0f7fdf39e4400032",
|
||||
@ -2131,7 +2139,7 @@
|
||||
"5524e8ba9b5545be"
|
||||
],
|
||||
"x": 894,
|
||||
"y": 1019,
|
||||
"y": 739,
|
||||
"w": 612,
|
||||
"h": 262
|
||||
},
|
||||
@ -2154,7 +2162,7 @@
|
||||
"81129efa6676b58e"
|
||||
],
|
||||
"x": 894,
|
||||
"y": 1299,
|
||||
"y": 1019,
|
||||
"w": 612,
|
||||
"h": 262
|
||||
},
|
||||
@ -4963,6 +4971,72 @@
|
||||
"resend": false,
|
||||
"debugEnabled": false
|
||||
},
|
||||
{
|
||||
"id": "9643a7993e266372",
|
||||
"type": "ha-entity-config",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"deviceConfig": "",
|
||||
"name": "Emma Door Alert",
|
||||
"version": 6,
|
||||
"entityType": "switch",
|
||||
"haConfig": [
|
||||
{
|
||||
"property": "name",
|
||||
"value": "Emma Door Alert"
|
||||
},
|
||||
{
|
||||
"property": "icon",
|
||||
"value": "mdi:door"
|
||||
},
|
||||
{
|
||||
"property": "entity_picture",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"property": "entity_category",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"property": "device_class",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"resend": false,
|
||||
"debugEnabled": false
|
||||
},
|
||||
{
|
||||
"id": "7d7c641acaff9284",
|
||||
"type": "ha-entity-config",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"deviceConfig": "",
|
||||
"name": "Emma Door Alert Cancel",
|
||||
"version": 6,
|
||||
"entityType": "button",
|
||||
"haConfig": [
|
||||
{
|
||||
"property": "name",
|
||||
"value": "Emma Door Alert Cancel"
|
||||
},
|
||||
{
|
||||
"property": "icon",
|
||||
"value": "mdi:cancel"
|
||||
},
|
||||
{
|
||||
"property": "entity_picture",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"property": "entity_category",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"property": "device_class",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"resend": false,
|
||||
"debugEnabled": false
|
||||
},
|
||||
{
|
||||
"id": "afead614fabc01bb",
|
||||
"type": "function",
|
||||
@ -13852,8 +13926,8 @@
|
||||
"service": "turn_off",
|
||||
"output_location": "",
|
||||
"output_location_type": "none",
|
||||
"x": 1410,
|
||||
"y": 960,
|
||||
"x": 550,
|
||||
"y": 1360,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -13871,8 +13945,8 @@
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 1150,
|
||||
"y": 840,
|
||||
"x": 290,
|
||||
"y": 1240,
|
||||
"wires": [
|
||||
[
|
||||
"440fc7142e7345d4"
|
||||
@ -13917,8 +13991,8 @@
|
||||
"blockInputOverrides": false,
|
||||
"domain": "timer",
|
||||
"service": "start",
|
||||
"x": 1410,
|
||||
"y": 900,
|
||||
"x": 550,
|
||||
"y": 1300,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -13949,8 +14023,8 @@
|
||||
"blockInputOverrides": false,
|
||||
"domain": "timer",
|
||||
"service": "cancel",
|
||||
"x": 1410,
|
||||
"y": 840,
|
||||
"x": 550,
|
||||
"y": 1240,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -13975,8 +14049,8 @@
|
||||
"valueType": "date"
|
||||
}
|
||||
],
|
||||
"x": 1000,
|
||||
"y": 960,
|
||||
"x": 140,
|
||||
"y": 1360,
|
||||
"wires": [
|
||||
[
|
||||
"cef61cdb2808ce5a"
|
||||
@ -14028,8 +14102,8 @@
|
||||
"valueType": "str"
|
||||
}
|
||||
],
|
||||
"x": 990,
|
||||
"y": 840,
|
||||
"x": 130,
|
||||
"y": 1240,
|
||||
"wires": [
|
||||
[
|
||||
"3b698d0a4f2620bd"
|
||||
@ -14065,8 +14139,8 @@
|
||||
"blockInputOverrides": false,
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"x": 1400,
|
||||
"y": 780,
|
||||
"x": 540,
|
||||
"y": 1180,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14102,8 +14176,8 @@
|
||||
"override_payload": "msg",
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 1210,
|
||||
"y": 960,
|
||||
"x": 350,
|
||||
"y": 1360,
|
||||
"wires": [
|
||||
[
|
||||
"c3f2a4aa281295ce"
|
||||
@ -14402,7 +14476,7 @@
|
||||
"output_location": "",
|
||||
"output_location_type": "none",
|
||||
"x": 1410,
|
||||
"y": 1240,
|
||||
"y": 960,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14421,7 +14495,7 @@
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 1150,
|
||||
"y": 1120,
|
||||
"y": 840,
|
||||
"wires": [
|
||||
[
|
||||
"5524e8ba9b5545be"
|
||||
@ -14467,7 +14541,7 @@
|
||||
"domain": "timer",
|
||||
"service": "start",
|
||||
"x": 1410,
|
||||
"y": 1180,
|
||||
"y": 900,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14499,7 +14573,7 @@
|
||||
"domain": "timer",
|
||||
"service": "cancel",
|
||||
"x": 1410,
|
||||
"y": 1120,
|
||||
"y": 840,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14525,7 +14599,7 @@
|
||||
}
|
||||
],
|
||||
"x": 1000,
|
||||
"y": 1240,
|
||||
"y": 960,
|
||||
"wires": [
|
||||
[
|
||||
"0b5424aadc3479f7"
|
||||
@ -14578,7 +14652,7 @@
|
||||
}
|
||||
],
|
||||
"x": 990,
|
||||
"y": 1120,
|
||||
"y": 840,
|
||||
"wires": [
|
||||
[
|
||||
"4954c509d4d697e2"
|
||||
@ -14620,7 +14694,7 @@
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 1210,
|
||||
"y": 1240,
|
||||
"y": 960,
|
||||
"wires": [
|
||||
[
|
||||
"f3824e4c7e202605"
|
||||
@ -14655,7 +14729,7 @@
|
||||
"domain": "input_select",
|
||||
"service": "select_option",
|
||||
"x": 1400,
|
||||
"y": 1060,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14689,7 +14763,7 @@
|
||||
"output_location": "",
|
||||
"output_location_type": "none",
|
||||
"x": 1410,
|
||||
"y": 1520,
|
||||
"y": 1240,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14708,7 +14782,7 @@
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 1150,
|
||||
"y": 1400,
|
||||
"y": 1120,
|
||||
"wires": [
|
||||
[
|
||||
"81129efa6676b58e"
|
||||
@ -14754,7 +14828,7 @@
|
||||
"domain": "timer",
|
||||
"service": "start",
|
||||
"x": 1410,
|
||||
"y": 1460,
|
||||
"y": 1180,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14786,7 +14860,7 @@
|
||||
"domain": "timer",
|
||||
"service": "cancel",
|
||||
"x": 1410,
|
||||
"y": 1400,
|
||||
"y": 1120,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -14812,7 +14886,7 @@
|
||||
}
|
||||
],
|
||||
"x": 1000,
|
||||
"y": 1520,
|
||||
"y": 1240,
|
||||
"wires": [
|
||||
[
|
||||
"4a431478798a51c8"
|
||||
@ -14865,7 +14939,7 @@
|
||||
}
|
||||
],
|
||||
"x": 990,
|
||||
"y": 1400,
|
||||
"y": 1120,
|
||||
"wires": [
|
||||
[
|
||||
"3063e6a5b5c3f677"
|
||||
@ -14907,7 +14981,7 @@
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 1210,
|
||||
"y": 1520,
|
||||
"y": 1240,
|
||||
"wires": [
|
||||
[
|
||||
"e270c73896a1a50c"
|
||||
@ -14942,7 +15016,7 @@
|
||||
"domain": "input_select",
|
||||
"service": "select_option",
|
||||
"x": 1400,
|
||||
"y": 1340,
|
||||
"y": 1060,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -15050,6 +15124,265 @@
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "0367216416de8b4d",
|
||||
"type": "server-state-changed",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Door",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 6,
|
||||
"outputs": 1,
|
||||
"exposeAsEntityConfig": "9643a7993e266372",
|
||||
"entities": {
|
||||
"entity": [
|
||||
"binary_sensor.emma_bedroom_door"
|
||||
],
|
||||
"substring": [],
|
||||
"regex": []
|
||||
},
|
||||
"outputInitially": false,
|
||||
"stateType": "str",
|
||||
"ifState": "",
|
||||
"ifStateType": "str",
|
||||
"ifStateOperator": "is",
|
||||
"outputOnlyOnStateChange": true,
|
||||
"for": "0",
|
||||
"forType": "num",
|
||||
"forUnits": "minutes",
|
||||
"ignorePrevStateNull": false,
|
||||
"ignorePrevStateUnknown": true,
|
||||
"ignorePrevStateUnavailable": true,
|
||||
"ignoreCurrentStateUnknown": true,
|
||||
"ignoreCurrentStateUnavailable": true,
|
||||
"outputProperties": [
|
||||
{
|
||||
"property": "payload",
|
||||
"propertyType": "msg",
|
||||
"value": "",
|
||||
"valueType": "entityState"
|
||||
},
|
||||
{
|
||||
"property": "topic",
|
||||
"propertyType": "msg",
|
||||
"value": "door",
|
||||
"valueType": "str"
|
||||
}
|
||||
],
|
||||
"x": 110,
|
||||
"y": 1420,
|
||||
"wires": [
|
||||
[
|
||||
"03075516f3003707"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "03075516f3003707",
|
||||
"type": "function",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Door Alert",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst masterBedroomSleeping = states['input_boolean.master_bedroom_sleeping'].state\nconst emmaSleep = states['input_boolean.emma_sleeping'].state\nconst tonyAwake = states['input_boolean.tony_awake'].state\nconst xiaDesktopUser = states['sensor.xia_desktop_current_username'].state\nconst xiaDesktopIdle = states['binary_sensor.tina_desktop_idle'].state\nconst tonyLocation = states['person.tony_stork'].state\nconst tinaLocation = states['person.christina_stork'].state\nconst overnight = states['binary_sensor.overnight'].state\nconst payload = msg.payload\nconst topic = msg.topic\n\n// Set some default values\n\nlet who = 'Master Bedroom'\nlet tinaAvailable = false\nlet tonyAvailable = false\nlet enable = false\n\n// Determine who is available to respond\n\nif (tonyAwake === 'on' && tonyLocation === 'home') {\n tonyAvailable = true\n}\n\nif (xiaDesktopUser === 'irish' && xiaDesktopIdle === 'off' && tinaLocation === 'home') {\n tinaAvailable = true\n}\n\n// Determine where to send the alert to\n\nif (tinaAvailable === true || tonyAvailable === true) {\n who = 'Common Areas'\n}\n\n// Determine if the alert should be sent\n\nif (overnight === 'on' && masterBedroomSleeping === 'on') {\n enable = true\n} else if (overnight === 'off') {\n enable = true\n}\n\n// Define the alert message\n\nlet alertTTS = {\n \"topic\": who,\n \"payload\": \"Emma has opened her door, please check on her. I repeat, Emma has opened her door, please check on her. This is urgent, Emma is awake. PDS toddler warning, a large and extremely dangerous toddler is on the ground in your area.\",\n \"type\": \"critical\"\n}\n\n// Send the alert if conditions are met\n\nif (topic === 'door' && payload === 'on') {\n if (enable === true) {\n node.status({fill:'green',shape:'dot',text:`Sending alert to ${who}`})\n node.send([alertTTS,msg,null])\n } else {\n node.status({fill:'red',shape:'ring',text:'Door Opened, but no alert sent'})\n }\n} else if (topic === 'timer') {\n node.status({fill:'green',shape:'dot',text:'Timer Finished'})\n node.send([alertTTS,msg,null])\n} else if (topic === 'button') {\n node.status({fill:'green',shape:'dot',text:'Cancel Button Pressed'})\n node.send([null,null,msg])\n} else if (topic === 'door' && payload === 'off') {\n node.status({fill:'green',shape:'dot',text:'Door Closed'})\n}",
|
||||
"outputs": 3,
|
||||
"timeout": 0,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 340,
|
||||
"y": 1480,
|
||||
"wires": [
|
||||
[
|
||||
"2e356bc6f1ad80dc"
|
||||
],
|
||||
[
|
||||
"c9d498c1e323b1e4"
|
||||
],
|
||||
[
|
||||
"515f7471cec7bce2"
|
||||
]
|
||||
],
|
||||
"outputLabels": [
|
||||
"TTS Output",
|
||||
"Start Timer",
|
||||
"Cancel Timer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "2e356bc6f1ad80dc",
|
||||
"type": "subflow:6429099c4571dd6b",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "",
|
||||
"x": 560,
|
||||
"y": 1420,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "c9d498c1e323b1e4",
|
||||
"type": "api-call-service",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Start Timer",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "timer.start",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"timer.emma_door_alert"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "{\"duration\":\"00:00:30\"}",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "timer",
|
||||
"service": "start",
|
||||
"x": 550,
|
||||
"y": 1480,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "f7bd6d5fabdba0e0",
|
||||
"type": "server-events",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Timer Finished",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 3,
|
||||
"exposeAsEntityConfig": "",
|
||||
"eventType": "timer.finished",
|
||||
"eventData": "{\"entity_id\":\"timer.emma_door_alert\"}",
|
||||
"waitForRunning": true,
|
||||
"outputProperties": [
|
||||
{
|
||||
"property": "payload",
|
||||
"propertyType": "msg",
|
||||
"value": "",
|
||||
"valueType": "date"
|
||||
},
|
||||
{
|
||||
"property": "topic",
|
||||
"propertyType": "msg",
|
||||
"value": "timer",
|
||||
"valueType": "str"
|
||||
}
|
||||
],
|
||||
"x": 140,
|
||||
"y": 1480,
|
||||
"wires": [
|
||||
[
|
||||
"03075516f3003707"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "515f7471cec7bce2",
|
||||
"type": "api-call-service",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Cancel Timer",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "timer.cancel",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"timer.emma_door_alert"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "timer",
|
||||
"service": "cancel",
|
||||
"x": 550,
|
||||
"y": 1540,
|
||||
"wires": [
|
||||
[
|
||||
"40dae72402f8cdee"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ca85b450d07da81c",
|
||||
"type": "ha-button",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Cancel Button",
|
||||
"version": 0,
|
||||
"debugenabled": false,
|
||||
"outputs": 1,
|
||||
"entityConfig": "7d7c641acaff9284",
|
||||
"outputProperties": [
|
||||
{
|
||||
"property": "payload",
|
||||
"propertyType": "msg",
|
||||
"value": "",
|
||||
"valueType": "entityState"
|
||||
},
|
||||
{
|
||||
"property": "topic",
|
||||
"propertyType": "msg",
|
||||
"value": "button",
|
||||
"valueType": "str"
|
||||
}
|
||||
],
|
||||
"x": 130,
|
||||
"y": 1540,
|
||||
"wires": [
|
||||
[
|
||||
"03075516f3003707"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "40dae72402f8cdee",
|
||||
"type": "api-call-service",
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "ba738e13229c781b",
|
||||
"name": "Volume Reset",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "script.volume_reset",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [],
|
||||
"labelId": [],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "script",
|
||||
"service": "volume_reset",
|
||||
"x": 740,
|
||||
"y": 1540,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "07049ae77b6751c6",
|
||||
"type": "server-state-changed",
|
||||
|
Reference in New Issue
Block a user