iOS Actionable Notification w/ Motion Detection and delays

Hello,

I’ve been watching these forums and trying to learn Node-RED together with JSON/JavaScript and automations.

I’ve been pretty successful creating some stuff due to these forums (and google). Right now I have a sequence which allows DOODS to scan images and based on motion and as a result send me a message if DOODS has found a person in the image. This sequence works flawlessly. However my current question is this:

  • I’d like to have the Actionable Notification to NOT send the upcoming notifications based on time (30 minutes, 4 hours or 8 hours). How do I do this? I’ve watched several possibilities but non which allow a Actionable Notification to change the delay (or influence it) and ignore the motion (or preferably not send a notification to me/us).

Here’s my working sequence:


(the picture maybe a bit hard to read but if you zoom in it should still be readable)

Here’s my actionable notification/follow up:


(I haven’t merged these two yet because I have no idea what the next move is)

The actionable notification works, so I have that going for me (which is nice… ;-)). But I have no idea how in the first sequence, I can add this to it to allow the actionable notification interfere with the sequence to delay it for 30 minutes/4 hours/8 hours.

It’s more like the “Handmatig” (Manual) trigger overwrites the delay timer and I am not sure what the appropriate action is (put it in and current state node or anything?). Can anyone point me in the right direction? Maybe a decent example concerning automation and how the actionable notification can interrupt new notifications.

I’ve been following tutorials of TheHookUp and others to no avail unfortunately.

10-02-21: See the solution here.

1 Like

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/actionable-notifications-subflow-for-android.html#use-case-1-get-a-notification-when-garage-door-is-left-open-with-ability-to-ignore-the-alert-for-an-amount-of-time

3 Likes

Very useful cookbooks! I have somehow missed it. Thank you @Kermit, will try this tomorrow and update here.

I’ve been checking on your automation for the garage door in Use Case 1 which seems to comes close to my wishes:

Even though I am on iOS, I do not understand how the sequence/flow works so a function node or trigger node. I am also not sure if the Actionable Notification node is any useful in my flow (I am using a switch node, which seems to trigger the appropriate set delay).

Man I feel dumb and uneducated in this matter. What is (the easiest to learn) best way to approach this and allow the iOS Action to delay any further messages from the Motion? Both sequences need to connect somewhere into each other, but the way to do it, I can’t seem to figure this out.

Does this help any?

[{"id":"8c90dfc.28f2f2","type":"change","z":"f656078a.752de8","name":"60 mins","rules":[{"t":"set","p":"ignore","pt":"msg","to":"60","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":524,"y":1056,"wires":[["6566fa4.a832004"]]},{"id":"df484d95.35a35","type":"change","z":"f656078a.752de8","name":"120 mins","rules":[{"t":"set","p":"ignore","pt":"msg","to":"120","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":524,"y":1088,"wires":[["6566fa4.a832004"]]},{"id":"6566fa4.a832004","type":"function","z":"f656078a.752de8","name":"ignore?","func":"if(msg.reset) {\n    context.set('timeout', null);\n    node.status({});\n    return;\n}\nif(msg.ignore) {\n    const timeout = Date.now() + msg.ignore * 60000;\n    const d = new Date(timeout);\n    context.set('timeout', timeout)\n    node.status({text: `Ignoring until ${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}`, fill: \"red\"});\n    return;\n}\n\nconst timeout = context.get('timeout') || 0;\n\nif(timeout > Date.now()) return;\n\nnode.status({});\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":700,"y":976,"wires":[["e341debf.4550a"]]},{"id":"13c8aaf9.466e05","type":"change","z":"f656078a.752de8","name":"30 mins","rules":[{"t":"set","p":"ignore","pt":"msg","to":"30","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":524,"y":1024,"wires":[["6566fa4.a832004"]]},{"id":"94f82f2b.5c989","type":"switch","z":"f656078a.752de8","name":"30, 60 or 120?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"30","vt":"num"},{"t":"eq","v":"60","vt":"num"},{"t":"eq","v":"120","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":336,"y":1056,"wires":[["13c8aaf9.466e05"],["8c90dfc.28f2f2"],["df484d95.35a35"]]},{"id":"f6f0da1b.dbee98","type":"server-state-changed","z":"f656078a.752de8","name":"iOS Notify Action","server":"","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"test","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":126,"y":1056,"wires":[["94f82f2b.5c989"]]},{"id":"fc4e371f.a5f638","type":"inject","z":"f656078a.752de8","name":"Test 30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30","payloadType":"num","x":146,"y":1104,"wires":[["94f82f2b.5c989"]]},{"id":"bb97177.f3647e8","type":"inject","z":"f656078a.752de8","name":"Test 60","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"60","payloadType":"num","x":148,"y":1136,"wires":[["94f82f2b.5c989"]]},{"id":"db136f7b.269fb","type":"inject","z":"f656078a.752de8","name":"Test 30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"120","payloadType":"num","x":148,"y":1168,"wires":[["94f82f2b.5c989"]]},{"id":"5d26a2fe.34fe9c","type":"server-state-changed","z":"f656078a.752de8","name":"motion?","server":"","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":512,"y":976,"wires":[["6566fa4.a832004"]]},{"id":"e341debf.4550a","type":"debug","z":"f656078a.752de8","name":"do stuff","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":892,"y":976,"wires":[]},{"id":"38b970bc.1757a","type":"inject","z":"f656078a.752de8","name":"motion","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":514,"y":928,"wires":[["6566fa4.a832004"]]},{"id":"b8ff20fd.7bd3a","type":"inject","z":"f656078a.752de8","name":"reset","props":[{"p":"reset","v":"","vt":"date"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":514,"y":880,"wires":[["6566fa4.a832004"]]}]
2 Likes

Wow this truly gives me insight into where the function has to be and how the entire process works with the different nodes. I should be able to succeed with your example! Your support is much appreciated. Will give an update this evening.

I’ve done it! All thanks to @Kermit

Getting the notification:
Watch : iOS

How it looks in NodeRED:

How the new notifications are ignored:
Ignore

For some reason I cannot mark your post (three dots and check) as the solution. :frowning:

1 Like