rules problems with %systime% and %syshour%

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mk7
Normal user
Posts: 4
Joined: 25 Feb 2018, 07:45

rules problems with %systime% and %syshour%

#1 Post by mk7 » 25 Feb 2018, 08:14

Hello!

I'm doing time relays on sonoff th 16 and espeasy v2.0-20180126

I can not check the time via systime and syshour variables

Rules example:

on Clock#Time do
if %syshour% >= 22
SendToHTTP 192.168.1.100,80,/check?%syshour%
endif
endon

Log:

2602213 : ACT : SendToHTTP 192.168.1.100,80,/check?10

As we see in log - now is 10 hours

But "if" condition return 'true' ...

It's my mistake ( why ? ) or espeasy problem ?

The %systime% compare also problems to work ...

if %systime% >= 22:05:00 - compare return false at 22:05 ...

Michael

Micha_he
Normal user
Posts: 63
Joined: 07 Feb 2018, 19:14

Re: rules problems with %systime% and %syshour%

#2 Post by Micha_he » 25 Feb 2018, 08:24

In my opinion, you can't use >= ! Instead use >21.

mk7
Normal user
Posts: 4
Joined: 25 Feb 2018, 07:45

Re: rules problems with %systime% and %syshour%

#3 Post by mk7 » 25 Feb 2018, 08:44

Thanks!

Can you look to my systime problem too ?

Here is "strong" "large" compare:

Rules:

on Clock#Time do
if %systime% > 10:36:00
SendToHTTP 192.168.1.100,80,/check?%syshour%
endif
endon

Time from main page:

Local Time: 2018-02-25 10:37:54

Log:

4341761 : EVENT: Clock#Time=Sun,10:38

10:38 is greater than 10:36

But SendToHTTP not executed.

Is 10:36 in compare must be "localtime" or gmt ?

When i change 10:36 at rules example to 7:36 - it's work, but i'm afraid to use it ...

User avatar
grovkillen
Core team member
Posts: 3262
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: rules problems with %systime% and %syshour%

#4 Post by grovkillen » 25 Feb 2018, 09:06

The rules engine doesn't compute systime mathematically. I'd use this instead:

Code: Select all

(%syshour% * 10 + %sysmin%) 

Maybe put that as a dummy value and do the logics test on that.

mk7
Normal user
Posts: 4
Joined: 25 Feb 2018, 07:45

Re: rules problems with %systime% and %syshour%

#5 Post by mk7 » 25 Feb 2018, 09:15

1 syshour * 60 + sysmin to avoid collisions ?

2 rules tutorial https://www.letscontrolit.com/wiki/inde ... rial_Rules example for systime

If %systime% > 19:00:00
Gpio,16,1
Endif

my example is a copy example above ...

mk7
Normal user
Posts: 4
Joined: 25 Feb 2018, 07:45

Re: rules problems with %systime% and %syshour%

#6 Post by mk7 » 25 Feb 2018, 09:49

if %syshour% * 60 + %sysmin% > 520 // 8-40
SendToHTTP 192.168.1.100,80,/check?%syshour%
endif

also does not work for me

what may be wrong with sys(time|hour|min) calculation

User avatar
grovkillen
Core team member
Posts: 3262
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: rules problems with %systime% and %syshour%

#7 Post by grovkillen » 25 Feb 2018, 10:32

grovkillen wrote:
25 Feb 2018, 09:06
The rules engine doesn't compute systime mathematically. I'd use this instead:

Code: Select all

(%syshour% * 10 + %sysmin%) 

Maybe put that as a dummy value and do the logics test on that.
That should have read :

Code: Select all

(%syshour% * 100 + %sysmin%) 
That would compute :

Code: Select all

(10*100+32) =1032
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests