linuxha / node-red-contrib-mytimeout

A dynamic count down timer for node-red
MIT License
10 stars 10 forks source link

Timer stops at 13s when timer set to 1h (3600s) #1

Closed trantoriana closed 5 years ago

trantoriana commented 6 years ago

When setting the timer to expire after one hour, the countdown stops always at 13 seconds.

Which make the time kind of unusable.

Please take a look at this.

linuxha commented 6 years ago

On 06/23/2018 05:46 AM, trantoriana wrote:

When setting the timer to expire after one hour, the countdown stops always at 13 seconds.

Which make the time kind of unusable.

Please take a look at this.

I'm checking it out now to see why this happnes.

-- Linux Home Automation Neil Cherry ncherry@linuxha.com http://www.linuxha.com/ Main site http://linuxha.blogspot.com/ My HA Blog Author of: Linux Smart Homes For Dummies

linuxha commented 6 years ago

I set up a sample flow in docker. I'm working the the 1.0.15 code now.

Two things, first I found a number of errors in my code. Basically I wonder how it work (???, it's awful code). Second, it works on my node-red flow with my sleep timers. So I'm looking at my flow to see what kept it propped up.

The closest I've come to replicating the problem you're seeing is that the timer counts down but least the node status yellow (warning) . But it did send the timer off payload.

The code is due for a rewrite after these fixes. I'll post my most recent fix soon.

BTW, what is the input you are sending to the node and is the node the latest 1.0.15 code?

trantoriana commented 6 years ago

The simplest workflow is as below which will cause the issue of stopping at 13s. A simple input node putting some arbitrary input into mytimeout node, in this case XX. The mytimeout node does not have a warning message nor warning timeout set... further the messages are ON and OFF on begin and end of the timer.

I use the timer as a real timer, not as intended a 'if no more messages are coming'. I turn ON a device on start, and turn the device OFF again of time expiry.

[{"id":"fe7ea6f7.f927a8","type":"mytimeout","z":"49c32a39.080204","name":"60 mins","outtopic":"","outsafe":"ON","outwarning":"","outunsafe":"OFF","warning":"","timer":"3600","limit":"","repeat":false,"again":false,"x":560,"y":120,"wires":[["5345e80d.6e57a8"]]},{"id":"5345e80d.6e57a8","type":"debug","z":"49c32a39.080204","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":120,"wires":[]},{"id":"6f08704.d0d739","type":"inject","z":"49c32a39.080204","name":"","topic":"","payload":"XX","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":120,"wires":[["fe7ea6f7.f927a8"]]}]

mytimeout version is 1.0.15 and node-red is 0.18.7

Trant

linuxha commented 6 years ago

I'm running the test on the new code now with your flow now.

I think I understand the magic number 13 (default warning if not set will be 12 but a blank warning means don't send a warning).

trantoriana commented 6 years ago

Retried the test with a warning defined and a warning message.... works as advertised....

As warning number is optional, this is a bug... At least I can fix my workflows so they run until the end.

trantoriana commented 6 years ago

ok, Issue only occurs when the "warning state payload" is not set...

linuxha commented 6 years ago

In the next release v1.0.16 (or v2.0.1) the "timer" will be changed to "timeout". Sorry I have it documented as "timeout" yet left it in the code as "timer". Not sure I can have both.

I'll also attempt to update the documentation a bit more. There is some undocumented behavior that needs to be clarified.

I'm currently putting together some unit tests. Lets see if I can properly test this code before I release it. Which ever version works best will be the next release. I'l Post here when it's ready. Unfortunately I have a busy week.

trantoriana commented 6 years ago

Hi Neil,

Sorry I have it documented as "timeout" yet left it in the code as "timer".

Not to worry, i will survive changing my 4 formula nodes

I'l Post here when it's ready. Unfortunately I have a busy week.

Again not to worry. I go on a extended 4 week leave myself, so take your time...

Tran

linuxha commented 6 years ago

I've updated the git repo and I see the npm publish on https://www.npmjs.com/package/node-red-contrib-mytimeout but I can't find the update on https://flows.nodered.org/. There, it still shows up as 1.0.15. I'm working to resolve this in the discord.

linuxha commented 6 years ago

I received help from the node-red folks on Discourse. The code now sits at 2.1.0. Please give it try.

linuxha commented 5 years ago

I believe that this issue has been fixed. Since I've not seen an update since July 9th I'm assuming that the current issue is resolved. If this issue reappears, reopen the issue of open a new issue and I'll work to resolve it then. Thanks