Compare systime with hours / minuts stored in dummy var

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Compare systime with hours / minuts stored in dummy var

#1 Post by Patou » 17 Apr 2020, 20:51

Hello,
To make a kind of sheduler I want to compare the %systime% to a time stored in a dummy variable or mqtt helper.
Dummy#var1 = 11 ( 11 o-clock)
Dummy#var2 = 30 ( 30 minuts)
This is simple to write over mqtt from a controller.
rule line should be :
if %systime% > 11:30 ....
Can i transform 11:30 in seconds with : let,1, [Dummy#var1]*3600+[Dummy#var2]*60
and make rule
i f %systime% > [var#1]
Thanks in advance for your advices
Patou

User avatar
Grumpf
Normal user
Posts: 124
Joined: 05 May 2017, 23:45
Location: Namur

Re: Compare systime with hours / minuts stored in dummy var

#2 Post by Grumpf » 31 Aug 2020, 09:12

How is your time stored ? if you transform everything in seconds like

if (%syshour%*3600+%sysmin%*60+%syssec%) > [var#1]

Won't that work ?

Also you came with a solution proposal, not your issue. If you describe your objectives we may help you better.
Cheers !

TD-er
Core team member
Posts: 8737
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Compare systime with hours / minuts stored in dummy var

#3 Post by TD-er » 31 Aug 2020, 09:35

Depends on what you want to do.

Do you want to change something at some time, then you can just act on that time.
If you also want to set some value at reboot, then you indeed must compare like described by Grumpf.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 43 guests