Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer does not stop for FLOAT timeout values #10

Open
tsprivate opened this issue Aug 25, 2018 · 3 comments
Open

Timer does not stop for FLOAT timeout values #10

tsprivate opened this issue Aug 25, 2018 · 3 comments

Comments

@tsprivate
Copy link

Hi, I was experimenting a bit further with your timeout.

I have a calculated timeout which is a float value. When passing the float ast msg.timeout into your

  • The timer is accepting the float
  • The timer is counting down
    ->> The counter never stops as it does not reach 0

[{"id":"7dd3409d.0daae","type":"mytimeout","z":"b1d09add.6b04a8","name":"timer","outtopic":"","outsafe":"on","outwarning":"Warning","outunsafe":"off","warning":"5","timer":"20.001","debug":"0","repeat":false,"again":false,"x":510,"y":380,"wires":[["559dcc7d.65e6f4"],["559dcc7d.65e6f4"]]},{"id":"745c54b6.b9a71c","type":"inject","z":"b1d09add.6b04a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":380,"wires":[["cd407dbc.6a09"]]},{"id":"cd407dbc.6a09","type":"change","z":"b1d09add.6b04a8","name":"timeout","rules":[{"t":"set","p":"timeout","pt":"msg","to":"6.1234567","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":380,"wires":[["7dd3409d.0daae"]]},{"id":"559dcc7d.65e6f4","type":"debug","z":"b1d09add.6b04a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":710,"y":380,"wires":[]}]

image

@linuxha
Copy link
Owner

linuxha commented Aug 25, 2018

I need to add in the document that mytimeout can only handle integer numbers. The issue is that the design counts down in 1 second intervals. So the time never hit 0 but was less than 0. Zero means timer has stopped, less than zero means time is not running. I coudn't come up with a decent design to handle floats.

I will look at the input to see if I can force it to an int to make sure it behaves better (hits zero and sends the off).

@tsprivate
Copy link
Author

I just used a function node in front of the timeout and did a simple parseInt() to the timeout value. This sorted the issue for me

@readeral
Copy link

readeral commented Sep 3, 2018

With #14 meaning that the Interval starts and stops (rather than continues to run) changing else if(ticks == 0) to else if(ticks <= 0) in the 'TIX' event listener should now be possible (as it won't continue to trigger, and respond to a -1 value). This would resolve this problem without the need for a function node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants