This object is in archive! 
Problem with calculations of time values
Need Answer
Hi!
I have made a function for detecting a kitchen extract fan being on for too long, and give a push notification (and switch off power suplly in next step) if we forget it. I have made the function work part from one thing: i cannot seem to be able to subtract time values?
i use the function timeof (now) and add that to a var1 . I then add timeof(now) at a later stage to var2. I then want to use the result of var2-var1 but it is always 0. I see in the push notification that var 1 is e.g. 80000178 anv var2 is 79005367. I assume this is in milliseconds. But when i try to subtract one from the other i always get 0.0....
Any ideas?
Files:
VariablesNotSub...
No connection
Real-time notifications may not work
wow, thats seems overly complicated to simply run a timer. Why so complex?
Why not just have a rule that is trigger by the fan turning on (or power consumption level if thats what you need), a wait timer, refresh all and check if fan is still on, if so turn it off?
Im not sure if the variables can be added and subtracted etc, like this, their uses arent entirely clear to me.
wow, thats seems overly complicated to simply run a timer. Why so complex?
Why not just have a rule that is trigger by the fan turning on (or power consumption level if thats what you need), a wait timer, refresh all and check if fan is still on, if so turn it off?
Im not sure if the variables can be added and subtracted etc, like this, their uses arent entirely clear to me.
Hi Adrian!
Thanks for your feedback. I am aware it is a little complex, it is merely to have control of the running times in between states (i have programmed like this before in PLC's), and there's more to come in the different section in the code, I just wanted to get it to work first. I will take your idea into consideration though!
I guess my real issue is why i cannot add/subtract two variables.. i think that should work like this, if not why do we have the +- operators?
Hi Adrian!
Thanks for your feedback. I am aware it is a little complex, it is merely to have control of the running times in between states (i have programmed like this before in PLC's), and there's more to come in the different section in the code, I just wanted to get it to work first. I will take your idea into consideration though!
I guess my real issue is why i cannot add/subtract two variables.. i think that should work like this, if not why do we have the +- operators?
Replies have been locked on this page!