From a840ba86a0fa20fa4dcf6785ba7970ba61799c5f Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 22 Sep 2022 19:16:34 -0400 Subject: [PATCH] Add completed flow for text notification system --- flows.json | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 427 insertions(+), 3 deletions(-) diff --git a/flows.json b/flows.json index b860df4..55763fb 100644 --- a/flows.json +++ b/flows.json @@ -1201,6 +1201,36 @@ "w": 1132, "h": 322 }, + { + "id": "5595964c8367c984", + "type": "group", + "z": "ee67610b4a0578d2", + "name": "Text Notification System", + "style": { + "label": true + }, + "nodes": [ + "98626a8f2b59bde3", + "47bc783fd78f5aa8", + "95652a59518e2767", + "3d5448e57ef666a0", + "5de6d772e1ecdd22", + "c684d82a2abea389", + "ba18895fef9810bd", + "20666f8c1488d423", + "db6d955c039873be", + "e3ef7fe6bcad3b74", + "d2fec32d385dae8c", + "0145961e8276c53e", + "fd623c46a558a01a", + "926fc60ea00ddfb0", + "c52cae79eb97bcc0" + ], + "x": 14, + "y": 439, + "w": 1192, + "h": 302 + }, { "id": "19b0e082db0643ac", "type": "junction", @@ -18693,6 +18723,7 @@ "id": "98626a8f2b59bde3", "type": "ha-button", "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", "name": "Send Notification", "version": 0, "debugenabled": false, @@ -18719,15 +18750,18 @@ } ], "x": 120, - "y": 480, + "y": 520, "wires": [ - [] + [ + "e3ef7fe6bcad3b74" + ] ] }, { "id": "47bc783fd78f5aa8", "type": "ha-button", "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", "name": "Reset Text Notification", "version": 0, "debugenabled": false, @@ -18754,7 +18788,397 @@ } ], "x": 140, - "y": 540, + "y": 580, + "wires": [ + [ + "d2fec32d385dae8c", + "0145961e8276c53e", + "fd623c46a558a01a" + ] + ] + }, + { + "id": "95652a59518e2767", + "type": "api-current-state", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Message", + "server": "9e87348d.9c1c48", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_text.text_notification", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "payload", + "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": 440, + "y": 520, + "wires": [ + [ + "3d5448e57ef666a0", + "5de6d772e1ecdd22" + ] + ] + }, + { + "id": "3d5448e57ef666a0", + "type": "api-current-state", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Phones", + "server": "9e87348d.9c1c48", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_select.select_phones", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "phones", + "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": 620, + "y": 480, + "wires": [ + [ + "c684d82a2abea389" + ] + ] + }, + { + "id": "5de6d772e1ecdd22", + "type": "api-current-state", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "TVs", + "server": "9e87348d.9c1c48", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_select.select_tvs", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "tvs", + "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": 610, + "y": 560, + "wires": [ + [ + "ba18895fef9810bd" + ] + ] + }, + { + "id": "c684d82a2abea389", + "type": "switch", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "", + "property": "phones", + "propertyType": "msg", + "rules": [ + { + "t": "neq", + "v": "None", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 1, + "x": 770, + "y": 480, + "wires": [ + [ + "20666f8c1488d423" + ] + ] + }, + { + "id": "ba18895fef9810bd", + "type": "switch", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "", + "property": "tvs", + "propertyType": "msg", + "rules": [ + { + "t": "neq", + "v": "None", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 1, + "x": 770, + "y": 560, + "wires": [ + [ + "926fc60ea00ddfb0" + ] + ] + }, + { + "id": "20666f8c1488d423", + "type": "function", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Formatting", + "func": "var phones = msg.phones.toLowerCase()\n\nmsg.phones = phones\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 930, + "y": 480, + "wires": [ + [ + "db6d955c039873be" + ] + ] + }, + { + "id": "db6d955c039873be", + "type": "api-call-service", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Phone Notify", + "server": "9e87348d.9c1c48", + "version": 5, + "debugenabled": false, + "domain": "script", + "service": "text_notify", + "areaId": [], + "deviceId": [], + "entityId": [], + "data": "{\t \"who\": msg.phones,\t \"title\": msg.title,\t \"message\": msg.payload\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "x": 1110, + "y": 480, + "wires": [ + [] + ] + }, + { + "id": "e3ef7fe6bcad3b74", + "type": "api-current-state", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Title", + "server": "9e87348d.9c1c48", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_text.text_notification_title", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "title", + "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": 290, + "y": 520, + "wires": [ + [ + "95652a59518e2767" + ] + ] + }, + { + "id": "d2fec32d385dae8c", + "type": "api-call-service", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Reset Title", + "server": "9e87348d.9c1c48", + "version": 5, + "debugenabled": false, + "domain": "input_text", + "service": "set_value", + "areaId": [], + "deviceId": [], + "entityId": [ + "input_text.text_notification_title" + ], + "data": "{\t \"value\":\"Type your title here\"\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "x": 350, + "y": 580, + "wires": [ + [] + ] + }, + { + "id": "0145961e8276c53e", + "type": "api-call-service", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Reset Body", + "server": "9e87348d.9c1c48", + "version": 5, + "debugenabled": false, + "domain": "input_text", + "service": "set_value", + "areaId": [], + "deviceId": [], + "entityId": [ + "input_text.text_notification" + ], + "data": "{\t \"value\":\"Type your notification here\"\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "x": 350, + "y": 640, + "wires": [ + [] + ] + }, + { + "id": "fd623c46a558a01a", + "type": "api-call-service", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Reset Options", + "server": "9e87348d.9c1c48", + "version": 5, + "debugenabled": false, + "domain": "input_select", + "service": "select_option", + "areaId": [], + "deviceId": [], + "entityId": [ + "input_select.select_phones", + "input_select.select_tvs" + ], + "data": "{\t \"option\":\"None\"\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "x": 360, + "y": 700, + "wires": [ + [] + ] + }, + { + "id": "926fc60ea00ddfb0", + "type": "function", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "Formatting", + "func": "const str = msg.tvs\nvar tvs = str.replaceAll(\" \", \"_\")\nvar tvLower = tvs.toLowerCase()\n\nmsg.tvs = tvLower\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 930, + "y": 560, + "wires": [ + [ + "c52cae79eb97bcc0" + ] + ] + }, + { + "id": "c52cae79eb97bcc0", + "type": "api-call-service", + "z": "ee67610b4a0578d2", + "g": "5595964c8367c984", + "name": "TV Notify", + "server": "9e87348d.9c1c48", + "version": 5, + "debugenabled": false, + "domain": "script", + "service": "tv_notify", + "areaId": [], + "deviceId": [], + "entityId": [], + "data": "{\t \"who\": msg.tvs,\t \"title\": msg.title,\t \"message\": msg.payload\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "x": 1100, + "y": 560, "wires": [ [] ]