From 0ca099aaa37ac66d580bb0e1104159506dd10c26 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Fri, 18 Aug 2023 22:19:48 -0400 Subject: [PATCH] Rework phone/tv notification flow --- flows.json | 96 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/flows.json b/flows.json index 09e96ed..212a8b1 100644 --- a/flows.json +++ b/flows.json @@ -781,7 +781,9 @@ "f1dbb3a206dba921" ], "x": 14, - "y": 719 + "y": 719, + "w": 1552, + "h": 642 }, { "id": "e065b1ed4938b477", @@ -859,7 +861,9 @@ "ed625c0b4f7c98ff" ], "x": 14, - "y": 19 + "y": 19, + "w": 2252, + "h": 682 }, { "id": "5c50443a84910fb7", @@ -899,7 +903,9 @@ "51b11f9d5b8bfbb0" ], "x": 34, - "y": 179 + "y": 179, + "w": 1292, + "h": 382 }, { "id": "477e752fcd2e2a19", @@ -918,7 +924,9 @@ "f4bfbaca4d7fb1df" ], "x": 14, - "y": 39 + "y": 39, + "w": 1192, + "h": 82 }, { "id": "50e4d951ee7b3e54", @@ -939,7 +947,9 @@ "0107164ee7ff63d6" ], "x": 14, - "y": 139 + "y": 139, + "w": 1072, + "h": 142 }, { "id": "fbbe69a14cbe0236", @@ -987,7 +997,9 @@ "febc179b34c8cf71" ], "x": 34, - "y": 39 + "y": 39, + "w": 692, + "h": 682 }, { "id": "46275dd0f9461013", @@ -1005,7 +1017,9 @@ "ca88f85ba00a6744" ], "x": 34, - "y": 739 + "y": 739, + "w": 472, + "h": 202 }, { "id": "ff6d8150e8d5e606", @@ -1041,7 +1055,9 @@ "f111c40459e27629" ], "x": 34, - "y": 19 + "y": 19, + "w": 1272, + "h": 502 }, { "id": "208284848b13b85b", @@ -1066,7 +1082,9 @@ "c0933fcc8737bc0b" ], "x": 34, - "y": 239 + "y": 239, + "w": 1032, + "h": 322 }, { "id": "1ca205a84922c8c2", @@ -1116,7 +1134,9 @@ "f44427c5a493c428" ], "x": 14, - "y": 299 + "y": 299, + "w": 1152, + "h": 242 }, { "id": "eeafd13be593ae69", @@ -1150,7 +1170,9 @@ "f5fb96bf1a33b3cd" ], "x": 54, - "y": 19 + "y": 19, + "w": 1492, + "h": 282 }, { "id": "0c81dfaed25d225c", @@ -1231,7 +1253,9 @@ "2516c6e3146cc851" ], "x": 34, - "y": 619 + "y": 619, + "w": 1112, + "h": 282 }, { "id": "f519aff597ece351", @@ -1350,7 +1374,9 @@ "51d05298561cfddb" ], "x": 754, - "y": 39 + "y": 39, + "w": 672, + "h": 262 }, { "id": "b708cb6d93f40dee", @@ -1366,7 +1392,9 @@ "e59180a1a6ae0a90" ], "x": 1094, - "y": 659 + "y": 659, + "w": 632, + "h": 82 }, { "id": "265593f442864b6a", @@ -1383,7 +1411,9 @@ "a8d7f5e5d4f549b0" ], "x": 34, - "y": 579 + "y": 579, + "w": 732, + "h": 162 }, { "id": "4886967d0f8c0156", @@ -1424,7 +1454,9 @@ "5ba9cfc0194ef62a" ], "x": 754, - "y": 319 + "y": 319, + "w": 672, + "h": 622 }, { "id": "931cc27100c9317e", @@ -1443,7 +1475,9 @@ "f9bc4d36a0df7947" ], "x": 34, - "y": 759 + "y": 759, + "w": 672, + "h": 222 }, { "id": "6e83103b5c5311e9", @@ -1461,7 +1495,9 @@ "a75651492e779bfc" ], "x": 34, - "y": 19 + "y": 19, + "w": 912, + "h": 142 }, { "id": "88f099618e56926d", @@ -1543,7 +1579,9 @@ "15f7382daddb4b3e" ], "x": 34, - "y": 999 + "y": 999, + "w": 632, + "h": 82 }, { "id": "31767ffd6a647579", @@ -1608,7 +1646,9 @@ "8146f43fea5aec03" ], "x": 34, - "y": 539 + "y": 539, + "w": 1192, + "h": 502 }, { "id": "b9ffa3fa5af46ec3", @@ -24444,18 +24484,6 @@ "propertyType": "msg", "value": "", "valueType": "entityState" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "entity" } ], "x": 120, @@ -24538,7 +24566,7 @@ "entityId": [ "input_text.text_notification" ], - "data": "{\t \"value\": body\t}", + "data": "{\t \"value\": payload\t}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, @@ -24664,7 +24692,7 @@ "z": "ee67610b4a0578d2", "g": "5595964c8367c984", "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, "noerr": 0, "initialize": "",