Need rule systime
Moderators: grovkillen, Stuntteam, TD-er
Need rule systime
Hi, a rule is required - if the system time is greater than 23:00 and less than 7:00 then do not enable gpio. I can't understand the syntax correctly.
Re: Need rule systime
See the system variables page for all system variables and their current value to get more ideas to use those.
And of course, see the rules documentation page: https://espeasy.readthedocs.io/en/lates ... Rules.html
I think the %syshour% variable is the easiest to use here as you don't need to check the minutes for your request.
N.B. see the >=23 to match 23:00 and later and the <7 to match upto 6:59
And of course, see the rules documentation page: https://espeasy.readthedocs.io/en/lates ... Rules.html
I think the %syshour% variable is the easiest to use here as you don't need to check the minutes for your request.
Code: Select all
if %syshour% >= 23 or %syshour% <7
// This is the time window you requested
else
// Time window where the GPIO may be set
endif
Re: Need rule systime
the logic is clear, I tried a similar option with %systime% - it did not work. Have you tried your version? is he functional? Are the "On .... do" lines not required here?
Re: Need rule systime
The on...do lines are for sure needed.
You need to act on an event, and in the on...do line you specify on what event you need to act.
So not sure what else you need or how often (or when) this check needs to be performed.
I assume you need to check it when the time is set (not yet at boot, but when you know the time) and switch the state when you get to the right moment.
Something like this, not tested, just a quick write down.
You need to act on an event, and in the on...do line you specify on what event you need to act.
So not sure what else you need or how often (or when) this check needs to be performed.
I assume you need to check it when the time is set (not yet at boot, but when you know the time) and switch the state when you get to the right moment.
Code: Select all
on Time#Set do
if %syshour% >= 23 or %syshour% <7
// This is the time window you requested
else
// Time window where the GPIO may be set
endif
endon
on Clock#Time=All,23:00 do //will run once a day at 23:00
// Do the stuff you need to do
endon
on Clock#Time=All,7:00 do //will run once a day at 7:00
// Do the stuff you need to do
endon
Who is online
Users browsing this forum: No registered users and 102 guests