Stoptimer node not stopping

Hello All
i am having trouble with a node and I don't know what is wrong. i am hoping it is a bug in my logic but it doesn't appear to be. I am using a 3rd party "stoptimer" node that I have loaded the latest version (from 3 years ago) via the pallet.
I have used it as a timer when I flip a switch it starts a timer after that timer has elapsed it turns off the light. My problem is when I flip the light on it starts the timer; within the alloted time i turn off the light manually. I have added logic to stop the countdown because i had a bug. if
I turned on a light, it started a 30 minute timer. I then turn it off manually. (timer still running) I then turn it on again within the same 30 minutes. If there is 5 minutes left on the timer it then turns off the light after 5 minutes even though it hasn't reset the timer.
To get around this bug I added logic to stop the timer but when I inject "stop" or "STOP" via msg.payload like it says in the description it doesn't actually stop the timer at all. it still displays running and it still counting down
here is the code. Can someone have a look? If this is a bug in the node can someone suggest a replacement countdown timer node?

[{"id":"e8eecae6.f82478","type":"comment","z":"18ee747c.043b6c","name":"Bathroom","info":"","x":180,"y":1700,"wires":[]},{"id":"1ca08dea.5d7e12","type":"mqtt out","z":"18ee747c.043b6c","name":"","topic":"shellies/shelly1-BCDDC277C6FC/relay/0/command","qos":"","retain":"","broker":"8482818a.01de4","x":1630,"y":1760,"wires":[]},{"id":"302c6189.948cde","type":"mqtt in","z":"18ee747c.043b6c","name":"","topic":"shellies/shelly1-BCDDC277C6FC/relay/0","qos":"2","datatype":"auto","broker":"8482818a.01de4","x":260,"y":1760,"wires":[["2954d7d8.1f62f8","d9b8c28c.34322"]]},{"id":"a09cef18.7f8d7","type":"gate","z":"18ee747c.043b6c","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":950,"y":1760,"wires":[["2d4625ce.73c5da"]]},{"id":"cf396abf.441f48","type":"stoptimer","z":"18ee747c.043b6c","duration":"30","units":"Minute","payloadtype":"str","payloadval":"off","name":"","x":1300,"y":1760,"wires":[["3cdf78d4.b020a8"],["1ca08dea.5d7e12","95ea77f5.09a0e8","3cdf78d4.b020a8"]]},{"id":"95ea77f5.09a0e8","type":"change","z":"18ee747c.043b6c","name":"Reopen Gate","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":1680,"wires":[["a09cef18.7f8d7"]]},{"id":"3d6056d0.296d3a","type":"delay","z":"18ee747c.043b6c","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":640,"y":1720,"wires":[["f29500b4.4c568"]]},{"id":"f29500b4.4c568","type":"change","z":"18ee747c.043b6c","name":"Close Gate","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":1720,"wires":[["a09cef18.7f8d7"]]},{"id":"3065edff.f15292","type":"inject","z":"18ee747c.043b6c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":900,"y":1640,"wires":[["95ea77f5.09a0e8"]]},{"id":"2954d7d8.1f62f8","type":"rbe","z":"18ee747c.043b6c","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":510,"y":1760,"wires":[["a09cef18.7f8d7","3d6056d0.296d3a"]]},{"id":"b8dc8544.228b68","type":"inject","z":"18ee747c.043b6c","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1290,"y":1960,"wires":[["1ca08dea.5d7e12"]]},{"id":"2762fd6e.ae6b22","type":"inject","z":"18ee747c.043b6c","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1290,"y":2000,"wires":[["1ca08dea.5d7e12"]]},{"id":"d9b8c28c.34322","type":"ui_switch","z":"18ee747c.043b6c","name":"","label":"Bathroom Light","tooltip":"","group":"b89d9404.bb26a8","order":7,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"wb_sunny","oncolor":"yellow","offvalue":"off","offvalueType":"str","officon":"wb_sunny","offcolor":"grey","x":1300,"y":1900,"wires":[["1ca08dea.5d7e12","7c80019b.ef51d","4e478870.648208"]]},{"id":"ea46a429.4f8278","type":"ui_switch","z":"18ee747c.043b6c","name":"","label":"Enable Timer","tooltip":"","group":"b89d9404.bb26a8","order":6,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"control","style":"","onvalue":"open","onvalueType":"str","onicon":"done","oncolor":"green","offvalue":"close","offvalueType":"str","officon":"highlight_off","offcolor":"red","x":970,"y":1800,"wires":[["2d4625ce.73c5da"]]},{"id":"21d06225.3a6a1e","type":"inject","z":"18ee747c.043b6c","name":"","topic":"","payload":"open","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":790,"y":1800,"wires":[["ea46a429.4f8278"]]},{"id":"2d4625ce.73c5da","type":"gate","z":"18ee747c.043b6c","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1090,"y":1760,"wires":[["cf396abf.441f48"]]},{"id":"1694b434.ef567c","type":"ui_text","z":"18ee747c.043b6c","group":"b89d9404.bb26a8","order":5,"width":0,"height":0,"name":"","label":"Bathroom","format":"{{msg.payload}}","layout":"row-spread","x":320,"y":1700,"wires":[]},{"id":"7c80019b.ef51d","type":"switch","z":"18ee747c.043b6c","name":"check for off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1470,"y":1840,"wires":[["9a33b8b7.e762f8","dfcc2827.db25c8"]]},{"id":"9a33b8b7.e762f8","type":"change","z":"18ee747c.043b6c","name":"set to stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1650,"y":1840,"wires":[["cf396abf.441f48","343606f2.02ddba"]]},{"id":"343606f2.02ddba","type":"debug","z":"18ee747c.043b6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1840,"y":1860,"wires":[]},{"id":"3cdf78d4.b020a8","type":"debug","z":"18ee747c.043b6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1520,"y":1720,"wires":[]},{"id":"dfcc2827.db25c8","type":"debug","z":"18ee747c.043b6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1610,"y":1940,"wires":[]},{"id":"4e478870.648208","type":"debug","z":"18ee747c.043b6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1533.01171875,"y":1993.265625,"wires":[]},{"id":"8482818a.01de4","type":"mqtt-broker","z":"","name":"MQTT","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b89d9404.bb26a8","type":"ui_group","z":"","name":"Lights","tab":"337f4dcb.e66472","disp":true,"width":"6","collapse":false},{"id":"337f4dcb.e66472","type":"ui_tab","z":"","name":"Bathroom","icon":"fa-s15","order":4,"disabled":false,"hidden":false}]

If I can suggest, can you install and try the stoptimer-varidelay node instead? It's my variation of stoptimer, with some additional functionality and I'm pretty sure it doesn't have that behavior.

I will certainly try that! thanks so much for the suggestion.
Troubleshooting a little more i THINK what is actually happening. When I issue a stop command it does actually stop the timer (still not 100% sure on this) but it doesn't update the running/stop status in the node red configuration interface. But when the timer is supposed to end even though it has previously stopped it then updates the status like it should

@hamsando

Ok your stop timer is actually great for troubleshooting. I love being able to see the time counting down on the actual node. So I have narrowed down the problem I BELIEVE.
Did you take an existing stop timer (the one i was using) and add additional functionality?
If so I believe yours is exhibiting the same behavior and I have it somewhat narrowed down.
So in my flow when I click a buton and that button state sends an off command. I have a change node switch the message payload to "stop" like the stop timer needs.
It proceeds to send it to the stop timer. The stop timer reports "stopped" but it continues to countdown.
HOWEVER, if I manually inject a stop with a inject node with "stop" it actually stops the timer. It will be sent to the stop timer it will report "stopped" and actually stop the timer.
So I have 2 suspicions 1) the stop timer is for some reason not recognizing the "stop" from msg.payload (set as a string) from the change node; bug in the node somewhere
2) the change node for w/e reason is not actually sending a string of "stop" it's sending "stop" but in another format thus the stop timer node see's it but doens't do anything with it because the manual inject node of "stop" as a string will completely halt the timer and update the status on the page

I will continue to troubleshoot. Any other suggestions would be great from you or anyone

Edit: to not continually spam this. I created a function node that ONLY sends a msg.payload of "stop" as a string this also does not stop the actual timer from counting down. The stop timer recognizes it and replies through its outputs "stopped" but the timer still counts down. I guess this would prove it is not 2) option. Now I am just confused because the inject node of stop and function node of stop both output a string of "stop". Confirmed this through debug nodes.
I do not understand why the timer node does not recognise this.

I also tested putting an inject node behind the function node. When I inject anything the function node turns it by default to msg.payload = "stop" which sends it to the timer node. When this is done the timer node will THEN actually stop.
I honestly have no clue what is going on. I would like to say it's the timer node but idk
I can share the new updated flow if people want to see what I am talking about instead of just describing

Yes, please share the flow. I've tried to recreate based on your text descriptions, but for me it always stops

can you also put a debug node connected to the output of the change node (in your original flow) or after the function node in your new test flow and set it from msg.payload to showing the whole object - and post the the output of that debug when you send the stop.

Can I just say I am/was reading the post and see the name stoptimer.

I went and looked. There are THREE of them. It also may be handy to specify which of the three you are using.

Edit.

Ok, if it is this one: This one It looks like you could use the trigger node to do what it is doing.

Ok, I haven't dived too deep into all the exact parts, but in reading what the stoptimer does.... I am pretty sure the trigger node can do that.

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