Possible to use previoustate in rules ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
DaveS
Normal user
Posts: 25
Joined: 12 Feb 2018, 17:35

Possible to use previoustate in rules ?

#1 Post by DaveS » 10 Jan 2019, 17:48

Hi Chaps,

ESPeasy is monitoring my rain water tanks and controlling 2 latching solenoid valves - one on tank supply to house and another on the council water feed.

I use the rules below but the solenoids are pulsed every few seconds even if their state does not need to change.

Code: Select all

On WaterLevel#Litres>10 do
gpio,13,1   //status LED
gpio,14,0  // status LED
Pulse,4,1,500  // pulse solenoid valve 1
endon

On WaterLevel#Litres<10 do
gpio,14,1
gpio,13,0
Pulse,5,1,500  // pulse solenoid valve 2
endon
Is there a "previousstate" type command that can be used in rules to disable the rule unless the solenoid needs to change state ?

Cheers

User avatar
iron
Normal user
Posts: 78
Joined: 24 Sep 2016, 08:37
Location: Veria, Greece
Contact:

Re: Possible to use previoustate in rules ?

#2 Post by iron » 10 Jan 2019, 19:19

Hello,

gpiotoggle,<pin#>

will toggle the state of the pin if this is what you are asking ?

-D
-D

DaveS
Normal user
Posts: 25
Joined: 12 Feb 2018, 17:35

Re: Possible to use previoustate in rules ?

#3 Post by DaveS » 10 Jan 2019, 19:26

Hi,
Thanks for the reply,however I am trying to configure the rules so they trigger once only when the waterlevel#litres>10 and again when waterlevel#litres<10 condition is met,not pulse the solenoid control IO's over and over.

User avatar
iron
Normal user
Posts: 78
Joined: 24 Sep 2016, 08:37
Location: Veria, Greece
Contact:

Re: Possible to use previoustate in rules ?

#4 Post by iron » 10 Jan 2019, 19:45

How about ?

On WaterLevel#Litres>10 and gpio#13=0 do

Not even sure if you can you use AND/OR in the event, but you can try and let us know.

If not :

On WaterLevel#Litres>10 do
If gpio#13=0
gpio,13,1 //status LED
gpio,14,0 // status LED
Pulse,4,1,500 // pulse solenoid valve 1
endif
endon

On WaterLevel#Litres<10 do
if gpio#13=1
gpio,14,1
gpio,13,0
Pulse,5,1,500 // pulse solenoid valve 2
endif
endon

-D
-D

DaveS
Normal user
Posts: 25
Joined: 12 Feb 2018, 17:35

Re: Possible to use previoustate in rules ?

#5 Post by DaveS » 11 Jan 2019, 19:59

Thanks iron for the idea,rule below working perfectly, I was thinking of setting up a dummy item but this is a simpler method ..

On WaterLevel#Litres>220 do
if [TankSolenoid#State]=0
gpio,13,1
gpio,14,0
Pulse,4,1,500
endon

On WaterLevel#Litres<220 do
if [MuniSolenoid#State]=0
gpio,14,1
gpio,13,0
Pulse,5,1,500
endon

Cheers

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests