Actionable notifications in node red

Hey

im trying to learn some about the actionable notification function in the past days.
Im done with the automation and it works great but now im trying to do the same stuff in Node Red.

So how to achieve the same in Node Red?

Thanks 4 any advise

this is what I know so far :slight_smile:

{"message":"Cam Test!","data":{"push":{"category":"camera"},"entity_id":"camera.ID"}}

Have you seen this marvelous piece?

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/actionable-notifications-subflow-for-android.html

That is such a cool piece of software!

3 Likes

so far…
But im missing a third Option if no respons taken for x sec.
As an an example : Are you sleeping? wait for 90 sec if no respons start xy…

[{"id":"3d819487.07370c","type":"api-call-service","z":"fb7bf027.974ec","name":"Notify","server":"fefd8095.1f637","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_iphone","entityId":"","data":"{\t    \"message\": \"Noch wach?\",\t    \"title\": \"Schläfst du schon?\",\t    \"data\": {\t        \"actions\": [\t            {\t                \"action\": \"sleep_yes\",\t                \"title\": \"zZz\"\t            },\t            {\t                \"action\": \"sleep_no\",\t                \"title\": \"Nein\"\t            }\t        ]\t            }\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":2660,"wires":[[]]},{"id":"80a5b71f.881708","type":"server-events","z":"fb7bf027.974ec","name":"","server":"fefd8095.1f637","version":1,"event_type":"mobile_app_notification_action","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"}],"x":230,"y":2780,"wires":[["642680af.1a979"]]},{"id":"642680af.1a979","type":"switch","z":"fb7bf027.974ec","name":"","property":"payload.event.action","propertyType":"msg","rules":[{"t":"eq","v":"sleep_yes","vt":"str"},{"t":"eq","v":"sleep_no","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":2780,"wires":[["217957f.772eaa8","c2a05bd6.b4d9d8"],[]]},{"id":"a0ec5709.2c2028","type":"inject","z":"fb7bf027.974ec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 01 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":2640,"wires":[["aa9f427a.0e3a8"]]},{"id":"aa9f427a.0e3a8","type":"api-current-state","z":"fb7bf027.974ec","name":"","server":"fefd8095.1f637","version":2,"outputs":2,"halt_if":"True","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.state_manutv","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":440,"y":2620,"wires":[["3d819487.07370c"],[]]},{"id":"217957f.772eaa8","type":"api-call-service","z":"fb7bf027.974ec","name":"","server":"fefd8095.1f637","version":3,"debugenabled":false,"service_domain":"remote","service":"turn_off","entityId":"remote.harmony_manu","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":2840,"wires":[[]]},{"id":"c2a05bd6.b4d9d8","type":"debug","z":"fb7bf027.974ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":3020,"wires":[]},{"id":"b6613c86.42009","type":"comment","z":"fb7bf027.974ec","name":"Eingeschlafen?","info":"","x":150,"y":2580,"wires":[]},{"id":"fefd8095.1f637","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Solved it. Simply add an input_select option.

But maybe there is a cleaner / cooler way with javascript ( action ?!).

Here is, a sketch only

1 Like

Did you make it work? I have problems with the event.tag validation in the “belong here?” node. It seem the comparisome fails and the flow stops?

I tried out the Use Case 2 the vaccation timer.

Yes, I use this. If you can’t get it working ask in the github section?

1 Like

can you share code?

I have no code for this. I just sketched that to give an idea.
Send notification node sends initial message, starting countdown of the delay. When delay finishes, it calls “hurry up message”.
But if you react on the first actionable notification, you can cancel delay removing waiting message.