Set time + add timer for X-hrs + notify

Super new to HA and Node Red; so far I love it and I’m so glad to be moving away from my previous “Alexa” limitations.

With that said, I’ve done some searching and can’t seem to find the complete answer to this.

I’m making a simple Toggle Switch Routine for when I take my dog out. Basically I want it to do all the things it does now (shut lights off, lock door behind me etc) and also note the time I toggled it, and setup a notification after X-hrs to remind me to take him out again. But.. not between the hours of X:XX & X:XX.

I know this should be some simple variable stuff with some timers with a range somewhere but I just don’t know how to construct this sequence. Any example flows would be much appreciated

Thanks

OK so you need to map it out in pseudo code to start with and also answers a few things

  1. How to you propose to trigger this - some dashboard switch or automatically through bluetooth etc or a physical switch/button on your way out the door - if you want a manual switch (say on your phone) you could look at Blynk as easy to use and put together

a) Leave the house - toggle virtual switch - this would involve setting a variable with the current time
b) Add X hours to the current time for the next notification
c) enter into a loop running every minute to check if the current time is >= next notification time
d) Check that the current time does not fall into the hours of rest, if it does exit the loop (or set the reminder time to be after the rest hours have expired)
d) if it is a valid time send an alert (Telegram, Pushbullet or any of those are good for this) to your phone

What platform are you planning on running NR on ? If it s not memory constrained then the Moment node is a good one for time and date management and manipulation (but has a high memory overhead)

Start puttng some of these ideas into a flow and then post it up so we cna provide additional guidance

Craig

The node-red-contrib-cron-plus node can be sent multiple add instructions with a date & time.

Here is an example that interfaces with dashboard. It demonstrates the CRON node being populated dynamically (there are also importable examples built in to the node accessable under node-red menu import)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.