Rework phone/tv notification flow

This commit is contained in:
2023-08-18 22:19:48 -04:00
parent f40fa4928e
commit 0ca099aaa3

View File

@ -781,7 +781,9 @@
"f1dbb3a206dba921" "f1dbb3a206dba921"
], ],
"x": 14, "x": 14,
"y": 719 "y": 719,
"w": 1552,
"h": 642
}, },
{ {
"id": "e065b1ed4938b477", "id": "e065b1ed4938b477",
@ -859,7 +861,9 @@
"ed625c0b4f7c98ff" "ed625c0b4f7c98ff"
], ],
"x": 14, "x": 14,
"y": 19 "y": 19,
"w": 2252,
"h": 682
}, },
{ {
"id": "5c50443a84910fb7", "id": "5c50443a84910fb7",
@ -899,7 +903,9 @@
"51b11f9d5b8bfbb0" "51b11f9d5b8bfbb0"
], ],
"x": 34, "x": 34,
"y": 179 "y": 179,
"w": 1292,
"h": 382
}, },
{ {
"id": "477e752fcd2e2a19", "id": "477e752fcd2e2a19",
@ -918,7 +924,9 @@
"f4bfbaca4d7fb1df" "f4bfbaca4d7fb1df"
], ],
"x": 14, "x": 14,
"y": 39 "y": 39,
"w": 1192,
"h": 82
}, },
{ {
"id": "50e4d951ee7b3e54", "id": "50e4d951ee7b3e54",
@ -939,7 +947,9 @@
"0107164ee7ff63d6" "0107164ee7ff63d6"
], ],
"x": 14, "x": 14,
"y": 139 "y": 139,
"w": 1072,
"h": 142
}, },
{ {
"id": "fbbe69a14cbe0236", "id": "fbbe69a14cbe0236",
@ -987,7 +997,9 @@
"febc179b34c8cf71" "febc179b34c8cf71"
], ],
"x": 34, "x": 34,
"y": 39 "y": 39,
"w": 692,
"h": 682
}, },
{ {
"id": "46275dd0f9461013", "id": "46275dd0f9461013",
@ -1005,7 +1017,9 @@
"ca88f85ba00a6744" "ca88f85ba00a6744"
], ],
"x": 34, "x": 34,
"y": 739 "y": 739,
"w": 472,
"h": 202
}, },
{ {
"id": "ff6d8150e8d5e606", "id": "ff6d8150e8d5e606",
@ -1041,7 +1055,9 @@
"f111c40459e27629" "f111c40459e27629"
], ],
"x": 34, "x": 34,
"y": 19 "y": 19,
"w": 1272,
"h": 502
}, },
{ {
"id": "208284848b13b85b", "id": "208284848b13b85b",
@ -1066,7 +1082,9 @@
"c0933fcc8737bc0b" "c0933fcc8737bc0b"
], ],
"x": 34, "x": 34,
"y": 239 "y": 239,
"w": 1032,
"h": 322
}, },
{ {
"id": "1ca205a84922c8c2", "id": "1ca205a84922c8c2",
@ -1116,7 +1134,9 @@
"f44427c5a493c428" "f44427c5a493c428"
], ],
"x": 14, "x": 14,
"y": 299 "y": 299,
"w": 1152,
"h": 242
}, },
{ {
"id": "eeafd13be593ae69", "id": "eeafd13be593ae69",
@ -1150,7 +1170,9 @@
"f5fb96bf1a33b3cd" "f5fb96bf1a33b3cd"
], ],
"x": 54, "x": 54,
"y": 19 "y": 19,
"w": 1492,
"h": 282
}, },
{ {
"id": "0c81dfaed25d225c", "id": "0c81dfaed25d225c",
@ -1231,7 +1253,9 @@
"2516c6e3146cc851" "2516c6e3146cc851"
], ],
"x": 34, "x": 34,
"y": 619 "y": 619,
"w": 1112,
"h": 282
}, },
{ {
"id": "f519aff597ece351", "id": "f519aff597ece351",
@ -1350,7 +1374,9 @@
"51d05298561cfddb" "51d05298561cfddb"
], ],
"x": 754, "x": 754,
"y": 39 "y": 39,
"w": 672,
"h": 262
}, },
{ {
"id": "b708cb6d93f40dee", "id": "b708cb6d93f40dee",
@ -1366,7 +1392,9 @@
"e59180a1a6ae0a90" "e59180a1a6ae0a90"
], ],
"x": 1094, "x": 1094,
"y": 659 "y": 659,
"w": 632,
"h": 82
}, },
{ {
"id": "265593f442864b6a", "id": "265593f442864b6a",
@ -1383,7 +1411,9 @@
"a8d7f5e5d4f549b0" "a8d7f5e5d4f549b0"
], ],
"x": 34, "x": 34,
"y": 579 "y": 579,
"w": 732,
"h": 162
}, },
{ {
"id": "4886967d0f8c0156", "id": "4886967d0f8c0156",
@ -1424,7 +1454,9 @@
"5ba9cfc0194ef62a" "5ba9cfc0194ef62a"
], ],
"x": 754, "x": 754,
"y": 319 "y": 319,
"w": 672,
"h": 622
}, },
{ {
"id": "931cc27100c9317e", "id": "931cc27100c9317e",
@ -1443,7 +1475,9 @@
"f9bc4d36a0df7947" "f9bc4d36a0df7947"
], ],
"x": 34, "x": 34,
"y": 759 "y": 759,
"w": 672,
"h": 222
}, },
{ {
"id": "6e83103b5c5311e9", "id": "6e83103b5c5311e9",
@ -1461,7 +1495,9 @@
"a75651492e779bfc" "a75651492e779bfc"
], ],
"x": 34, "x": 34,
"y": 19 "y": 19,
"w": 912,
"h": 142
}, },
{ {
"id": "88f099618e56926d", "id": "88f099618e56926d",
@ -1543,7 +1579,9 @@
"15f7382daddb4b3e" "15f7382daddb4b3e"
], ],
"x": 34, "x": 34,
"y": 999 "y": 999,
"w": 632,
"h": 82
}, },
{ {
"id": "31767ffd6a647579", "id": "31767ffd6a647579",
@ -1608,7 +1646,9 @@
"8146f43fea5aec03" "8146f43fea5aec03"
], ],
"x": 34, "x": 34,
"y": 539 "y": 539,
"w": 1192,
"h": 502
}, },
{ {
"id": "b9ffa3fa5af46ec3", "id": "b9ffa3fa5af46ec3",
@ -24444,18 +24484,6 @@
"propertyType": "msg", "propertyType": "msg",
"value": "", "value": "",
"valueType": "entityState" "valueType": "entityState"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
} }
], ],
"x": 120, "x": 120,
@ -24538,7 +24566,7 @@
"entityId": [ "entityId": [
"input_text.text_notification" "input_text.text_notification"
], ],
"data": "{\t \"value\": body\t}", "data": "{\t \"value\": payload\t}",
"dataType": "jsonata", "dataType": "jsonata",
"mergeContext": "", "mergeContext": "",
"mustacheAltTags": false, "mustacheAltTags": false,
@ -24664,7 +24692,7 @@
"z": "ee67610b4a0578d2", "z": "ee67610b4a0578d2",
"g": "5595964c8367c984", "g": "5595964c8367c984",
"name": "Processing", "name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar title = states['input_text.text_notification_title'].state\nvar message = states['input_text.text_notification'].state\nvar priority = states['input_select.text_notification_priority_level'].state\nvar phones = states['input_select.select_phones'].state.toLowerCase()\nvar tvs = states['input_select.select_tvs'].state.toLowerCase()\n\nvar phoneMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"phones\": phones\n}\nvar tvsMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"tvs\": tvs\n}\n\nvar resetMsg = {\n \"title\":\"Type your title here\",\n \"body\":\"Type your notification here\",\n \"options\":\"None\",\n \"priority\":\"Normal\"\n}\n\nif (phones != 'none' && tvs != 'none') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Phones and TVs\"});\n return[phoneMsg,tvsMsg,resetMsg]\n} else if (phones === 'none' && tvs != 'none') {\n node.status({fill:\"green\",shape:\"dot\",text:\"TVs Only\"});\n return[null,tvsMsg,resetMsg]\n} else if (phones != 'none' && tvs === 'none') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Phones Only\"});\n return[phoneMsg,null,resetMsg]\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No devices selected\"});\n return null\n}", "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar title = states['input_text.text_notification_title'].state\nvar message = states['input_text.text_notification'].state\nvar priority = states['input_select.text_notification_priority_level'].state\nvar phones = states['input_select.select_phones'].state.toLowerCase()\nvar tvs = states['input_select.select_tvs'].state.toLowerCase()\n\nvar phoneMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"phones\": phones\n}\nvar tvsMsg = {\n \"title\": title,\n \"payload\": message,\n \"priority\": priority,\n \"tvs\": tvs\n}\n\nvar resetMsg = {\n \"title\":\"Type your title here\",\n \"payload\":\"Type your notification here\",\n \"priority\":\"Normal\",\n \"options\":\"None\"\n}\n\nif (phones != 'none') {\n node.send([phoneMsg,null,null])\n}\n\nif (tvs != 'none') {\n node.send([null,tvsMsg,null])\n}\n\nif (phones === 'none' && tvs === 'none') {\n node.status({fill:\"red\",shape:\"ring\",text:\"No devices selected\"})\n} else {\n node.send([null, null, resetMsg])\n node.status({fill:\"green\",shape:\"dot\",text:\"Message sent\"})\n}",
"outputs": 3, "outputs": 3,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",