Rule question

33 views
Skip to first unread message

Larry Buchanan

unread,
Jul 18, 2021, 12:11:20 PM7/18/21
to TasmotaUsers
With the stock tasmota version (not compiled with the if then options added) are examples available of how I might make a rule that a switch only works between sunset and sunrise.   I would use setOption114 to detach switches from power and hoped I could have a rule so the switch only turns power on/off between sunset & sunrise.   

Philip Knowles

unread,
Jul 18, 2021, 4:21:55 PM7/18/21
to Larry Buchanan, TasmotaUsers

Start on the Rules page. This rule will give you a good start

Rules - Tasmota

 

Regards

 

Phil K

 

Sent from Mail for Windows 10

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/e216f856-dd3c-41ee-9671-cd879c398d17n%40googlegroups.com.

 

buchanan.larry

unread,
Jul 18, 2021, 7:32:52 PM7/18/21
to Philip Knowles, TasmotaUsers
I easily understand how to make a rule that a single condition,  (switch turned on, or sunset) triggers different actions.  But I dont understand how to structure a rule that it must meet two conditions to trigger one action. 



Sent from my Bell Samsung device over Canada's largest network.
Larry Buchanan

ΧΡΗΣΤΟΣ ΚΑΛΤΣΟΣ

unread,
Jul 19, 2021, 1:45:11 AM7/19/21
to buchanan.larry, Philip Knowles, TasmotaUsers
Hi,

You can just start a new line with the 2nd condition  and trigger the same action. Here is an example 

Rule1
  on tele-DS18B20#temperature<37 do Backlog power2 1; power3 3 endon
  on tele-DS18B20#temperature>50 do Backlog power2 1; power3 3 endon
  on button1#state=2 do Backlog power2 2; power3 3 endon
 
As you can see each line is a separate condition. In addition if  you need more than one reaction you have to use "backlog" (see the example) and use semicolon as command delimiter.

Regards,
Chris

**************************************************************

Chris Kaltsos(Χρήστος Κάλτσος)

Electronic Engineer (B.Sc.)

MSc in Ubiquitous Computing

Internet of Things ( IoT ) Specialist

Mobile: +306971567588

e-mail: chris.f...@gmail.com

**************************************************************




buchanan.larry

unread,
Jul 19, 2021, 9:14:23 AM7/19/21
to ΧΡΗΣΤΟΣ ΚΑΛΤΣΟΣ, Philip Knowles, TasmotaUsers
I guess my description not clear enough: I want both conditions to be satisfied at the same time before before the action is done. The switch is detached from the relay with setoption114. So I want a rule that the switch controls an action between sunset and sunrise and the switch not cause the action  from sunrise to sunset. 

ΧΡΗΣΤΟΣ ΚΑΛΤΣΟΣ

unread,
Jul 19, 2021, 9:38:25 AM7/19/21
to buchanan.larry, Philip Knowles, TasmotaUsers
Ok do a rule1 in  order to control a switch
and do another rule2 that enables rule1 in a specified time slot

for example 

Rule1

  on button1#state=2 do Backlog power2 2; power3 3 endon

Rule2
  on Time#Minute=35 do Backlog power2 0; power3 3;rule1 0 endon--->disable rule1 at 00:35am
  on Time#Minute=420 do rule1 1 endon----->enable rule1 at 07:00 am

time#minute is calculated in minutes after midnight

I hope this helps

**************************************************************

Chris Kaltsos(Χρήστος Κάλτσος)

Electronic Engineer (B.Sc.)

MSc in Ubiquitous Computing

Internet of Things ( IoT ) Specialist

Mobile: +306971567588

e-mail: chris.f...@gmail.com

**************************************************************



Philip Knowles

unread,
Jul 19, 2021, 9:41:20 AM7/19/21
to buchanan.larry, ΧΡΗΣΤΟΣ ΚΑΛΤΣΟΣ, TasmotaUsers

If you actually look at the link I pointed you to

Enable a PIR Switch only at night

 
SwitchMode1 14
PulseTime 60
Rule1
  ON Switch1#state=1 DO Backlog event checksunrise=%time%; event checksunset=%time% ENDON
  ON event#checksunrise<%sunrise% DO Power1 1 ENDON
  ON event#checksunset>%sunset% DO Power1 1 ENDON

 

It does EXACTLY what you want the only bit you don’t need is pulsetime 60

 

Sent from Mail for Windows 10

 

Reply all
Reply to author
Forward
0 new messages