Thanks for all that…
So in attempting to implement I spotted an issue… phone isn’t set in the separate flow in the subflow (so re-setting the Silent / DND fails)
I’ve attempted to counteract this by setting a flow variable in the notification message, and then using that in the second flow
However, something odd happens - I now get two follow up messages simply with “command_dnd” and “command_ringer_mode” - like it’s not processing them correctly
Not sure why?
[{"id":"68e0e33e7cab988c","type":"subflow","name":"[ALERT] High Priority","info":"","category":"","in":[{"x":280,"y":420,"wires":[{"id":"7deece9af33f0f1f"}]}],"out":[],"env":[],"meta":{},"color":"#DDAA99"},{"id":"6f7a2af12e022da8","type":"api-call-service","z":"68e0e33e7cab988c","name":"Silent Off","server":"3aa13fed.bf745","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_{{ phone }}","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": \"command_ringer_mode\",\t \"data\": {\t \"command\": \"normal\"\t }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":460,"wires":[["4874f50e45607a4b"]]},{"id":"7deece9af33f0f1f","type":"api-current-state","z":"68e0e33e7cab988c","name":"Poll DND State","server":"3aa13fed.bf745","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.{{ phone }}_do_not_disturb_sensor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"OriginalDNDState","propertyType":"flow","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":460,"y":420,"wires":[["ae99cd488150ea0b"]]},{"id":"ae64ecc29db84753","type":"api-current-state","z":"68e0e33e7cab988c","name":"Poll Silent State","server":"3aa13fed.bf745","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.{{ phone }}_ringer_mode","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"OriginalSilentState","propertyType":"flow","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":460,"y":460,"wires":[["6f7a2af12e022da8"]]},{"id":"ae99cd488150ea0b","type":"api-call-service","z":"68e0e33e7cab988c","name":"DND Off","server":"3aa13fed.bf745","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_{{ phone }}","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": \"command_dnd\",\t \"data\": {\t \"command\": \"off\"\t }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":420,"wires":[["ae64ecc29db84753"]]},{"id":"0ddf4fa49bb27a9e","type":"api-call-service","z":"68e0e33e7cab988c","name":"DND Revert","server":"3aa13fed.bf745","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_{{ phone }}","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": \"command_dnd\",\t \"data\": {\t \"command\": flow.OriginalDNDState\t }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":560,"wires":[[]]},{"id":"75598dbf308fc2f4","type":"api-call-service","z":"68e0e33e7cab988c","name":"Silent Revert","server":"3aa13fed.bf745","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_{{ phone }}","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": \"command_ringer_mode\",\t \"data\": {\t \"command\": flow.OriginalSilentState\t }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":560,"wires":[["3ec912b539a84914"]]},{"id":"3ec912b539a84914","type":"delay","z":"68e0e33e7cab988c","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":800,"y":560,"wires":[["0ddf4fa49bb27a9e"]]},{"id":"4874f50e45607a4b","type":"api-call-service","z":"68e0e33e7cab988c","name":"High Priority Notification","server":"3aa13fed.bf745","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_{{ phone }}","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": msg.noti_msg,\t \"title\": msg.noti_title,\t \"data\": {\t \"ttl\": 0,\t \"priority\": \"high\",\t \"media_stream\": \"alarm_stream\",\t \"channel\": \"Important_Alerts\"\t }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"message","propertyType":"flow","value":"noti_msg","valueType":"msg"},{"property":"phoneid","propertyType":"flow","value":"phone","valueType":"msg"}],"queue":"none","x":890,"y":460,"wires":[[]]},{"id":"f177e89ff36a705b","type":"server-events","z":"68e0e33e7cab988c","name":"Any phone receives notification with message","server":"3aa13fed.bf745","version":1,"event_type":"mobile_app_notification_received","exposeToHomeAssistant":false,"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"},{"property":"phone","propertyType":"msg","value":"phoneid","valueType":"flow"}],"x":210,"y":560,"wires":[["c2b476e661b4838a"]]},{"id":"c2b476e661b4838a","type":"switch","z":"68e0e33e7cab988c","name":"","property":"payload.event.message","propertyType":"msg","rules":[{"t":"eq","v":"message","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":560,"wires":[["75598dbf308fc2f4"]]},{"id":"93daeca88a951092","type":"debug","z":"68e0e33e7cab988c","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":640,"wires":[]},{"id":"b603ed5698adb425","type":"debug","z":"68e0e33e7cab988c","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":640,"wires":[]},{"id":"3aa13fed.bf745","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"},{"id":"886e49ba100bdd3e","type":"subflow:68e0e33e7cab988c","z":"7b2cc8dd2ab2726b","name":"Flood Alert (High Priority) ","env":[{"name":"phone","value":"pocox3","type":"str"},{"name":"title","value":"WARNING! FLOOD DETECTED","type":"str"},{"name":"message","value":"A FLOOD HAS BEEN DETECTED - DO SOMETHING!!!","type":"str"},{"name":"Message Body","value":"A FLOOD HAS BEEN DETECTED - DO SOMETHING!!!","type":"str"},{"name":"PHONE","value":"pocox3","type":"str"}],"x":610,"y":280,"wires":[]},{"id":"6e2e07e7eee7c09c","type":"inject","z":"7b2cc8dd2ab2726b","name":"TEST","props":[{"p":"payload"},{"p":"phone","v":"pocox3","vt":"str"},{"p":"noti_title","v":"WARNING! FLOOD DETECTED","vt":"str"},{"p":"noti_msg","v":"A FLOOD HAS BEEN DETECTED - DO SOMETHING!!!","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230,"y":280,"wires":[["886e49ba100bdd3e"]]}]
I’m also still unclear on the purpose of this: