How to disable rule at a specific time ?
Moderators: grovkillen, Stuntteam, TD-er
How to disable rule at a specific time ?
Hi All,
How can I disable the rule below every saturday from 16:00 till 23:00 only,every other day rule must be active.
on Pir_Sensor#Pir=1 do
if [LDR#Analog]<500
Publish RGB/0017F169/color/set,200,200,200
Publish RGB/0017F169/brightness/set,200
else
Publish RGB/0017F169/brightness/set,0
endif
endon
NTP has been setup and has synched with internet time server.
Thanks to all the devs for this brilliant firmware,have many nodes running espeasy and all are rock solid !
Thanks
Dave
How can I disable the rule below every saturday from 16:00 till 23:00 only,every other day rule must be active.
on Pir_Sensor#Pir=1 do
if [LDR#Analog]<500
Publish RGB/0017F169/color/set,200,200,200
Publish RGB/0017F169/brightness/set,200
else
Publish RGB/0017F169/brightness/set,0
endif
endon
NTP has been setup and has synched with internet time server.
Thanks to all the devs for this brilliant firmware,have many nodes running espeasy and all are rock solid !
Thanks
Dave
Re: How to disable rule at a specific time ?
Maybe this entry on the wiki can be helpful for you?
https://www.letscontrolit.com/wiki/inde ... Rules#Time
https://www.letscontrolit.com/wiki/inde ... Rules#Time
Re: How to disable rule at a specific time ?
I saw that but it details how to enable a rule or some operation,not disabling a rule.
I understand the day and time configuration but do not know how to implement the disabling of the rule between the 2 times
I will search further then.
I understand the day and time configuration but do not know how to implement the disabling of the rule between the 2 times
I will search further then.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
Can't you use a dummy variable and a if statement that will execute the rule of the dummy variable is set to zero?
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
Can't you use a "else" part?
Like "if <sunday> do... else ..." ?
I am not really familiar in the rules language.
Re: How to disable rule at a specific time ?
I think the rules are ok for simple timing setup, when it comes to more complex and/or weekly I prefer to move out from ESPeasy as it's not as flexible as needed and the rules can becaome way too complex and probably cosume lots of CPU.
As well without nested IFs the overall setup of combined criteria is as well not somethign easy to write and maintain.
PS: having all my devices communicating via MQTT setup on my RaspPi, I installed as well NodeRed and with this last one creating complex rules is a piece of cake !
As well without nested IFs the overall setup of combined criteria is as well not somethign easy to write and maintain.
PS: having all my devices communicating via MQTT setup on my RaspPi, I installed as well NodeRed and with this last one creating complex rules is a piece of cake !
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
Re: How to disable rule at a specific time ?
I agree that's a viable routegrovkillen wrote: ↑23 Aug 2018, 18:19 Can't you use a dummy variable and a if statement that will execute the rule of the dummy variable is set to zero?
Lets assume a dummy device on Task 8, called Sat#dummy
Code: Select all
On Clock#Time=Sat,16:00 do
Taskvalueset,8,1,1
Endon
On Clock#Time=Sat,23:00 do
Taskvalueset,8,1,0
Endon
on Pir_Sensor#Pir=1 do
if [LDR#Analog]<500 AND [Sat#dummy]=0
Publish RGB/0017F169/color/set,200,200,200
Publish RGB/0017F169/brightness/set,200
else
Publish RGB/0017F169/brightness/set,0
endif
endon
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: How to disable rule at a specific time ?
Thank you Toffel969,
That is exactly what I want to achieve.
Will try it.
Regards
Dave
That is exactly what I want to achieve.
Will try it.
Regards
Dave
Re: How to disable rule at a specific time ?
it works as far as the module does not reboot for any given reason on saturday between 16:00 and 23:00 

My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
I would do a check right on system#boot and set the dummy accordingly.
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
Agreed, thats a flaw.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
Code: Select all
On System#Boot do
TaskValueSet,8,2,[%sysweekday%][%syshour%]
Event,SetDummy
EndOn
On SetDummy do
If [Set#Dummy2]<116 OR [Set#Dummy2]>123
TaskValueSet,8,2,1
Else
TaskValueSet,8,2,0
EndIf
EndOn
Last edited by grovkillen on 24 Aug 2018, 23:15, edited 1 time in total.
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
Maybe change system#boot to ?
Code: Select all
Time#Initialized
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
Isn't that only triggered on boot ? So you need this rule in addition to the before mentioned. Also I think the taskvalueset should be 8,1,1/0grovkillen wrote: ↑24 Aug 2018, 23:04Code: Select all
On System#Boot do TaskValueSet,8,2,[%sysweekday%] TaskValueSet,8,3,[%syshour%] TaskValueSet,8,4,[Sat#Dummy2][Sat#Dummy3] Event,SetDummy EndOn On SetDummy do If [Set#Dummy]<716 AND [Set#Dummy]>723 TaskValueSet,8,2,1 Else TaskValueSet,8,2,0 EndIf EndOn
Other than that it makes the setup a lot more robust. It's an elegant way to achieve reboot proof behaviour. I was thinking about a clock#time=Sat,**:** combined with systime check to set the dummy.... " ESP on Saturdays you must check every minute if it's between 7 or 23 o clock and set the dummy


Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
I updated the post and suggested the Time#Initialized event instead 

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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
And it's a add on to your splendid rule that you suggested. Thumbs up!
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
And please bear in mind that this is me "coding" a rule on my phone on a Friday evening after two beers down 

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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
grovkillen wrote: ↑24 Aug 2018, 23:29 And please bear in mind that this is me "coding" a rule on my phone on a Friday evening after two beers down![]()

Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: How to disable rule at a specific time ?
As splendid as sophisticatedgrovkillen wrote: ↑24 Aug 2018, 23:18 And it's a add on to your splendid rule that you suggested. Thumbs up!

Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
Code: Select all
On Time#Initialized do
TaskValueSet,8,2,[%sysweekday%][%syshour%][%sysmin%]
Event,SetDummy
EndOn
On SetDummy do
If [Set#Dummy2]<71600 OR [Set#Dummy2]>72300
TaskValueSet,8,1,1
Else
TaskValueSet,8,1,0
EndIf
EndOn
On Clock#Time=Sat,16:00 do
Taskvalueset,8,1,1
Endon
On Clock#Time=Sat,23:00 do
Taskvalueset,8,1,0
Endon
on Pir_Sensor#Pir=1 do
if [LDR#Analog]<500 AND [Sat#dummy]=0
Publish RGB/0017F169/color/set,200,200,200
Publish RGB/0017F169/brightness/set,200
else
Publish RGB/0017F169/brightness/set,0
endif
endon

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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
Looks perfect to me.grovkillen wrote: ↑25 Aug 2018, 07:47That would be the entire rule set?Code: Select all
On Time#Initialized do TaskValueSet,8,2,[%sysweekday%][%syshour%][%sysmin%] Event,SetDummy EndOn On SetDummy do If [Set#Dummy2]<71600 OR [Set#Dummy2]>72300 TaskValueSet,8,1,1 Else TaskValueSet,8,1,0 EndIf EndOn On Clock#Time=Sat,16:00 do Taskvalueset,8,1,1 Endon On Clock#Time=Sat,23:00 do Taskvalueset,8,1,0 Endon on Pir_Sensor#Pir=1 do if [LDR#Analog]<500 AND [Sat#dummy]=0 Publish RGB/0017F169/color/set,200,200,200 Publish RGB/0017F169/brightness/set,200 else Publish RGB/0017F169/brightness/set,0 endif endon
![]()
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: How to disable rule at a specific time ?
Code: Select all
On Clock#Time=Sat,16:00 do
TaskValueSet 3, 1, 1
endon
On Clock#Time=Sat,22:00 do
TaskValueSet 3, 1, 0
endon
on Pir_Sensor#Pir=1 do
if [LDR#Analog]>1000 AND [Saturday#Inhibit]=0
Publish RGB/0017F169/color/set,200,200,200
Publish RGB/0017F169/brightness/set,200
endif
endon
on Pir_Sensor#Pir=0 do
if [LDR#Analog]>1000 AND [Saturday#Inhibit]=0
Publish RGB/0017F169/state/set,OFF
endif
endon
Edited original rule a bit as I need to publish Publish RGB/0017F169/state/set,OFF when the PIR timed out after no motion detected.
This rule publishes all the time whether PIR state is 0 or 1
Can this constant spamming of the broker cause slower response time or is that not going to be a problem ?
There are 3 other nodes that publish frequently on my network also.
Thanks for the advise.
Re: How to disable rule at a specific time ?
What is the delay setting on the PIR switch device? If it is not 0, thats what will happen.DaveS wrote: ↑27 Aug 2018, 17:56The rule above is working,good point regarding the node rebooting,will sort that.Code: Select all
On Clock#Time=Sat,16:00 do TaskValueSet 3, 1, 1 endon On Clock#Time=Sat,22:00 do TaskValueSet 3, 1, 0 endon on Pir_Sensor#Pir=1 do if [LDR#Analog]>1000 AND [Saturday#Inhibit]=0 Publish RGB/0017F169/color/set,200,200,200 Publish RGB/0017F169/brightness/set,200 endif endon on Pir_Sensor#Pir=0 do if [LDR#Analog]>1000 AND [Saturday#Inhibit]=0 Publish RGB/0017F169/state/set,OFF endif endon
Edited original rule a bit as I need to publish Publish RGB/0017F169/state/set,OFF when the PIR timed out after no motion detected.
This rule publishes all the time whether PIR state is 0 or 1
Can this constant spamming of the broker cause slower response time or is that not going to be a problem ?
There are 3 other nodes that publish frequently on my network also.
Thanks for the advise.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: How to disable rule at a specific time ?
The PIR delay is set to 1 as I wanted a quick response once motion is detected.
Will this constant publishing slow broker response down at all ?
Openhab and mosquitto broker is running on a Pi 2.
Thanks again for the help chaps !
Will this constant publishing slow broker response down at all ?
Openhab and mosquitto broker is running on a Pi 2.
Thanks again for the help chaps !
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
The publishing will not be a problem for the broker. BUT if you set the delay to 0 (i.e. disable) will make the unit publish a change instantaneous.
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
Ya just set that delay to 0 and the unit will behave the way you want.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: How to disable rule at a specific time ?
Code: Select all
on Pir_Sensor#Pir=1 do
if [LDR#Analog]>1000 AND [Saturday#Inhibit]=0
Publish RGB/0017F169/color/set,200,200,200
Publish RGB/0017F169/brightness/set,200
endif
endon
on Pir_Sensor#Pir=0 do
if [LDR#Analog]>1000 AND [Saturday#Inhibit]=0
Publish RGB/0017F169/state/set,OFF
endif
endon
These rules are working well but publish all the time to broker.
Is there a way to change the rules so that ESP easy will only publish once on Pir_Sensor state change ?
Thanks
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to disable rule at a specific time ?
You could use a dummy and toggle that one only if the pir changes from 1->0 or 0->1. So prior to publish check that dummy and if it is 1 publish and then set it to 0.
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

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: How to disable rule at a specific time ?
Good idea,will set it up like that.
Thank you
Thank you
Who is online
Users browsing this forum: No registered users and 22 guests