Basement On flow for Node-RED
Provides iOS actionable notifications to appropriate user if triggered by iOS or manual button (in HA app), or Alexa actionable notifications to appropriate room if triggered by Alexa.
This commit is contained in:
361
flows.json
361
flows.json
@ -1068,9 +1068,7 @@
|
||||
"2d5ec93a6ad16ce2"
|
||||
],
|
||||
"x": 34,
|
||||
"y": 239,
|
||||
"w": 1332,
|
||||
"h": 382
|
||||
"y": 239
|
||||
},
|
||||
{
|
||||
"id": "753e14252442d87d",
|
||||
@ -13470,7 +13468,9 @@
|
||||
"x": 135,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[]
|
||||
[
|
||||
"11aabd786c07244f"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -13525,7 +13525,9 @@
|
||||
"x": 190,
|
||||
"y": 720,
|
||||
"wires": [
|
||||
[]
|
||||
[
|
||||
"0c7ef72bd0ef47d4"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -13553,6 +13555,229 @@
|
||||
],
|
||||
"x": 190,
|
||||
"y": 840,
|
||||
"wires": [
|
||||
[
|
||||
"11aabd786c07244f"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "b3bb08ff51e46985",
|
||||
"type": "api-call-service",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "Alexa Actionable Notification",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 5,
|
||||
"debugenabled": false,
|
||||
"domain": "script",
|
||||
"service": "activate_alexa_actionable_notification",
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [],
|
||||
"data": "{\t \"text\": \"<voice name='Brian'><prosody rate='150%'>Would you like me to turn on the computer for Collin?</prosody></voice>\",\t \"event_id\": \"actionable_notification_kallen_computer_on\",\t \"alexa_device\": msg.last_alexa\t}",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"x": 680,
|
||||
"y": 720,
|
||||
"wires": [
|
||||
[
|
||||
"62e1cf32c070c9ae"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "eed94e04df746efe",
|
||||
"type": "api-current-state",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "Last Alexa",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 3,
|
||||
"outputs": 1,
|
||||
"halt_if": "",
|
||||
"halt_if_type": "str",
|
||||
"halt_if_compare": "is",
|
||||
"entity_id": "sensor.last_alexa",
|
||||
"state_type": "str",
|
||||
"blockInputOverrides": false,
|
||||
"outputProperties": [
|
||||
{
|
||||
"property": "last_alexa",
|
||||
"propertyType": "msg",
|
||||
"value": "",
|
||||
"valueType": "entityState"
|
||||
}
|
||||
],
|
||||
"for": "0",
|
||||
"forType": "num",
|
||||
"forUnits": "minutes",
|
||||
"override_topic": false,
|
||||
"state_location": "payload",
|
||||
"override_payload": "msg",
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 450,
|
||||
"y": 720,
|
||||
"wires": [
|
||||
[
|
||||
"b3bb08ff51e46985"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "0c7ef72bd0ef47d4",
|
||||
"type": "delay",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "",
|
||||
"pauseType": "delay",
|
||||
"timeout": "1",
|
||||
"timeoutUnits": "seconds",
|
||||
"rate": "1",
|
||||
"nbRateUnits": "1",
|
||||
"rateUnits": "second",
|
||||
"randomFirst": "1",
|
||||
"randomLast": "5",
|
||||
"randomUnits": "seconds",
|
||||
"drop": false,
|
||||
"allowrate": false,
|
||||
"outputs": 1,
|
||||
"x": 315,
|
||||
"y": 720,
|
||||
"wires": [
|
||||
[
|
||||
"eed94e04df746efe"
|
||||
]
|
||||
],
|
||||
"l": false
|
||||
},
|
||||
{
|
||||
"id": "11aabd786c07244f",
|
||||
"type": "function",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "user conversion",
|
||||
"func": "var userTrigger = msg.payload.context.user_id\n\nif (userTrigger === \"c3909d27048140729f002aaef0391775\") {\n msg.user = \"ios_tony\"\n} else if (userTrigger === \"f387a983651a4321a7411ff8cf36f949\") {\n msg.user = \"ios_tina\"\n} else if (userTrigger === \"879b4c04e32841b3ad1d2763a11b4e70\") {\n msg.user = \"ios_kallen\"\n}\n\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 315,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[
|
||||
"795c53ad6642733a"
|
||||
]
|
||||
],
|
||||
"l": false
|
||||
},
|
||||
{
|
||||
"id": "795c53ad6642733a",
|
||||
"type": "api-call-service",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "iOS Actionable Notification",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 5,
|
||||
"debugenabled": false,
|
||||
"domain": "notify",
|
||||
"service": "{{user}}",
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [],
|
||||
"data": "{\t \"title\":\"Basement On\",\t \"message\": \"Should I turn on Kallen's computer?\",\t \"data\": {\t \"actions\": [\t {\t \"action\": \"KALLEN_PC_YES\",\t \"title\": \"Yes\",\t \"icon\": \"mdi:thumb-up\"\t },\t {\t \"action\": \"KALLEN_PC_NO\",\t \"title\": \"No\",\t \"icon\": \"mdi:thumb-down\"\t }\t ]\t }\t}",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"x": 680,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[
|
||||
"62e1cf32c070c9ae"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "62e1cf32c070c9ae",
|
||||
"type": "api-call-service",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "Lights On",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 5,
|
||||
"debugenabled": false,
|
||||
"domain": "light",
|
||||
"service": "turn_on",
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"light.basement_studio_lights"
|
||||
],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"x": 920,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[
|
||||
"ea5306d6f92d9550"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ea5306d6f92d9550",
|
||||
"type": "api-call-service",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "Tony PC On",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 5,
|
||||
"debugenabled": false,
|
||||
"domain": "script",
|
||||
"service": "tony_desktop_wake",
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"x": 1090,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[
|
||||
"4829663e9913e2aa"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "4829663e9913e2aa",
|
||||
"type": "api-call-service",
|
||||
"z": "47f17992fab9b4f5",
|
||||
"name": "TV On",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 5,
|
||||
"debugenabled": false,
|
||||
"domain": "media_player",
|
||||
"service": "turn_on",
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"media_player.basement_tv"
|
||||
],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"x": 1250,
|
||||
"y": 780,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@ -22556,6 +22781,132 @@
|
||||
],
|
||||
"l": false
|
||||
},
|
||||
{
|
||||
"id": "f5aff29df4e07a4a",
|
||||
"type": "switch",
|
||||
"z": "bb961e59e2ef86c9",
|
||||
"name": "",
|
||||
"property": "payload.event.actionName",
|
||||
"propertyType": "msg",
|
||||
"rules": [
|
||||
{
|
||||
"t": "cont",
|
||||
"v": "YES",
|
||||
"vt": "str"
|
||||
},
|
||||
{
|
||||
"t": "cont",
|
||||
"v": "NO",
|
||||
"vt": "str"
|
||||
}
|
||||
],
|
||||
"checkall": "true",
|
||||
"repair": false,
|
||||
"outputs": 2,
|
||||
"x": 525,
|
||||
"y": 820,
|
||||
"wires": [
|
||||
[
|
||||
"7107656a6cbecce7"
|
||||
],
|
||||
[]
|
||||
],
|
||||
"l": false
|
||||
},
|
||||
{
|
||||
"id": "7107656a6cbecce7",
|
||||
"type": "api-call-service",
|
||||
"z": "bb961e59e2ef86c9",
|
||||
"name": "Kallen PC On",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 5,
|
||||
"debugenabled": false,
|
||||
"domain": "script",
|
||||
"service": "kallen_desktop_wake",
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"x": 680,
|
||||
"y": 820,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6bb57058f0a576e7",
|
||||
"type": "server-events",
|
||||
"z": "bb961e59e2ef86c9",
|
||||
"name": "iOS Notification Action Fired",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 2,
|
||||
"eventType": "ios.notification_action_fired",
|
||||
"exposeToHomeAssistant": false,
|
||||
"eventData": "",
|
||||
"haConfig": [
|
||||
{
|
||||
"property": "name",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"property": "icon",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"waitForRunning": true,
|
||||
"outputProperties": [
|
||||
{
|
||||
"property": "payload",
|
||||
"propertyType": "msg",
|
||||
"value": "",
|
||||
"valueType": "eventData"
|
||||
},
|
||||
{
|
||||
"property": "topic",
|
||||
"propertyType": "msg",
|
||||
"value": "$outputData(\"eventData\").event_type",
|
||||
"valueType": "jsonata"
|
||||
}
|
||||
],
|
||||
"x": 260,
|
||||
"y": 820,
|
||||
"wires": [
|
||||
[
|
||||
"e97b782efaaf5976"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e97b782efaaf5976",
|
||||
"type": "switch",
|
||||
"z": "bb961e59e2ef86c9",
|
||||
"name": "",
|
||||
"property": "payload.event.actionName",
|
||||
"propertyType": "msg",
|
||||
"rules": [
|
||||
{
|
||||
"t": "cont",
|
||||
"v": "KALLEN_PC",
|
||||
"vt": "str"
|
||||
}
|
||||
],
|
||||
"checkall": "true",
|
||||
"repair": false,
|
||||
"outputs": 1,
|
||||
"x": 445,
|
||||
"y": 820,
|
||||
"wires": [
|
||||
[
|
||||
"f5aff29df4e07a4a"
|
||||
]
|
||||
],
|
||||
"l": false
|
||||
},
|
||||
{
|
||||
"id": "a4c477269b22f766",
|
||||
"type": "ha-button",
|
||||
|
Reference in New Issue
Block a user