Thanks a lot for this STOPTIMER help. Had used it several times and this made it easy to fix.
Hmmā¦ in the trigger mode I miss the 2nd output ; maximum number of loopsā¦
You can also stop the loop by specifying a maximum number of loops, which when reached, will stop the loop and timer, as well as sending a payload of
max loops reached
through the second output.
Got any ideas for that ?
Loop timer advanced is newer and has the max loops reached through a second output.
Yes it is newer, nevertheless Updated 1 year, 9 months agoā¦
So both are oldā¦donāt really see the point hereš¤
Iām still using the originals. I doubt a timer will introduce a hacking vulnerability, I may be wrong but I donāt plan on changing them unless they stop working.
Itās true, the risk is probably very low. I do feel like it might be worth the effort to go from stop timer to trigger since itās a straightforward transition and the latter is maintained by nr team. It also has a lot more functionality packed into the one node.
I had never used looptimer so looking at it now. I donāt know any alternative to that besides a function node so Iād probably keep using that one too if I was using it.
I successfully replaced all my instances of looptimer and stoptimer with the trigger node. I changed the reset message inside the tigger node so that I could use it in my existing flows with no issues. I had originally planned to install the two nodes separately as had been suggested but after reading other posts I went this route, not due to any worries about security, it was all about future proofing.
How did you deal with setting the number of loops?
I put together a subflow that uses the trigger node to replicate looptimer since itās a little complicated.
Double clicking the node will let you change the variables.
There you can also click edit subflow to see the under lying nodes.
[{"id":"1f5ed1330e5fbbc4","type":"subflow","name":"loop subflow","info":"looptime = delay between loops\n\nEnter time in ms only!\n\nLoops are exact, does not add one like loop timer!\n\nIf msg.payload = stop or STOP, stops the loop!","category":"","in":[{"x":120,"y":300,"wires":[{"id":"288a6fc49b25b3b5"}]}],"out":[{"x":1480,"y":280,"wires":[{"id":"b301057f72b70d8c","port":0}]}],"env":[{"name":"looptime","type":"num","value":"250"},{"name":"loops","type":"num","value":"5"}],"meta":{},"color":"#DDAA99"},{"id":"b301057f72b70d8c","type":"trigger","z":"1f5ed1330e5fbbc4","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-1000","extend":false,"overrideDelay":true,"units":"ms","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":720,"y":280,"wires":[["d6b017426fdd5647"]]},{"id":"d6b017426fdd5647","type":"counter","z":"1f5ed1330e5fbbc4","name":"","init":"0","step":"1","lower":"","upper":"","mode":"increment","outputs":"1","x":940,"y":240,"wires":[["e28df21fabb703ad"]]},{"id":"e28df21fabb703ad","type":"switch","z":"1f5ed1330e5fbbc4","name":"","property":"count","propertyType":"msg","rules":[{"t":"gte","v":"loops","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":240,"wires":[["8208c41d977eac65"]]},{"id":"8208c41d977eac65","type":"change","z":"1f5ed1330e5fbbc4","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":140,"wires":[["d6b017426fdd5647","b301057f72b70d8c"]]},{"id":"a7068b3f0b87273a","type":"change","z":"1f5ed1330e5fbbc4","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"looptime","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":400,"wires":[["b301057f72b70d8c"]]},{"id":"288a6fc49b25b3b5","type":"switch","z":"1f5ed1330e5fbbc4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"stop","vt":"str"},{"t":"eq","v":"STOP","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":270,"y":300,"wires":[["8208c41d977eac65","b301057f72b70d8c"],["8208c41d977eac65","5df9f7902e4a0a3f"],["a7068b3f0b87273a"]]},{"id":"5df9f7902e4a0a3f","type":"change","z":"1f5ed1330e5fbbc4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":240,"wires":[["b301057f72b70d8c"]]},{"id":"91d82e999127bed8","type":"subflow:1f5ed1330e5fbbc4","z":"f80b6c338afd5483","name":"loop subflow","env":[{"name":"looptime","value":"1000","type":"num"},{"name":"loops","value":"6","type":"num"}],"x":990,"y":160,"wires":[["9555aeef94994375"]]},{"id":"6a961c064728b83f","type":"inject","z":"f80b6c338afd5483","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":740,"y":160,"wires":[["91d82e999127bed8"]]},{"id":"9555aeef94994375","type":"debug","z":"f80b6c338afd5483","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1230,"y":160,"wires":[]},{"id":"a0ba592e017eabb5","type":"inject","z":"f80b6c338afd5483","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"stop","payloadType":"str","x":730,"y":100,"wires":[["91d82e999127bed8"]]},{"id":"8e2cb24b7c860fdc","type":"inject","z":"f80b6c338afd5483","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"STOP","payloadType":"str","x":730,"y":40,"wires":[["91d82e999127bed8"]]}]
Thanks it works very well.
Looks useful, I will check it out.
For me, I do not care about the number of loops in my usage. I use the loops to send reminder notifications and stop the loops either by responding to the actionable notification or addressing the issue.
Can you share how you do it? It is something I should implement but have yet to do so. Tnx!
I have a simple Door Monitor/Alarm Flow. It has 3 modes - Disarmed, Monitor and Armed (these are input booleans I defined in HA). I plan to an additional Vacation mode as well as include a Guest option that will modify the behavior when we have overnight guests. A case of everything works for us at the moment so I am playing with a few other projects before I come back to this one.
In the Monitor operating mode I monitor if any of a subset of doors are open for longer than 45 secs. If one of these doors are open longer that this I send notifications to mine and my wifeās phones plus a wall mounted tablet and repeat this every 45 seconds until the door closes. The notification states which door(s) is open plus it gives a final notification when all doors are closed. Maybe overly complex but I am retired and this is fun!
Below is what I call my Monitor Event Handler (I have another one for Armed with a few more bells and whistles):
The inputs on the left are from the various door sensors (Zigbee). I have 1 group which are the main house doors plus 2 individual doors - the Garage door and the Refrigerator in the garage. I donāt monitor the Garage door in this mode but I do monitor the garage refrigerator. I flip this in the Alarm mode. We live in South FL so this mode is mainly so that we donāt leave a door open and air condition the outside! No AC in the garage so no worries.
The top 2 left inputs are door open events and the bottom 2 are door close events. The Current State nodes are so that inputs are only passed if the Monitor boolean is True. I have these on the input side and on the output side of this handler.
The Trigger node was a looptimer. The flow is the same, I simply replaced the looptimer with the trigger node and configured it as:
The Get Entities node is used twice. Itās input from the Trigger node is how I determine which door is open so that I can format it and send in my notification. It is also use to count the number of Closed doors so that I can stop the looping notifications and send the All Doors Closed notification.
Hope this helps. Feel free to comment or ask for more detail. This is how I did it - I am sure there are other, better ways to do this.
BTW - below is my lovelace dashboard for my phone for my Alarm.
@stanman1958 Thank you so much for all the detail. I am working on that part of my automation and you gave me lots of great tips and ideas on how to get it done!
Thanks for this - it was trivial to add triggers instead and I prefer this to relying on something thatās no longer maintained.
Hmmā¦ this node-red-contrib-looptimer is a whopping 130 lines of java scriptā¦ not much to maintain on that then is there?
When software is working as should, there is no need to update it just for the sake of updating itā¦.
yeah, my node red broke on that last update, but as was already said, I just put the stoptimer package (and others) in the npm_packages
section for the addon config.
At least they didnāt āGoogleā us by getting rid of the feature entirely
Maintain it then
Good job weāve all got choices and opinions of our own eh?
Is update just canceling STOPTIMER or STOPTIMER VARI DELAY as well? Cause I updated and my stoptimer vari delays still work.
I already went and replaced all my plain ole STOPTIMERās with trigger nodes before updating.
Just stoptimer and looptimer that were included in the default install. Anyhow, they can easily be re-installed, or you can update your flows to use something else as discussed in this thread.