rule to control relay
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
rule to control relay
Hello,
I have a wemos d1 mini whit espeasy to which a humidity sensor is attached.
I would like that when I register a certain value, (less than X) an ON command to be sent to the relay with the IP 192.x.x.x (esp01 + tasmota).
somebody can help me pls ?
I have a wemos d1 mini whit espeasy to which a humidity sensor is attached.
I would like that when I register a certain value, (less than X) an ON command to be sent to the relay with the IP 192.x.x.x (esp01 + tasmota).
somebody can help me pls ?
Re: rule to control relay
Welcome.
First you need to have enabled the Rules feature on the Tools/ Advanced page:
(Tolerant last parameter is optional, both Rules checkboxes should be on)
After that you can enter a new rule in the Rules tab.
I've assumed a BME280 sensor in this example, and the 20 and 30 used are just somewhat randomly selected values.
First you need to have enabled the Rules feature on the Tools/ Advanced page:
(Tolerant last parameter is optional, both Rules checkboxes should be on)
After that you can enter a new rule in the Rules tab.
Code: Select all
on BME280#Humidity do
if %eventvalue1% <> %v1%
if %eventvalue% < 20 // A bit dry, turn humidifier on
sendtohttp,192.x.x.x,80,/cm?cmnd=Power%20ON // Turn relay on
endif
if %eventvalue1% > 30 // Humid enough, humidifier off
sendtohttp,192.x.x.x,80,/cm?cmnd=Power%20OFF // Turn relay off
endif
endif
let,1,%eventvalue1% // Save last checked value
endon
/Ton (PayPal.me)
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
Re: rule to control relay
humidity information is taken from a soil moisture sensor. I already have the active rule option, because I have another rule. I attach print screen with sensors.
Thanks for the help
Thanks for the help
- Attachments
-
- sensor.jpg (164.59 KiB) Viewed 7035 times
-
- rule.jpg (117.07 KiB) Viewed 7035 times
Last edited by florin.ssk@gmail.com on 01 May 2021, 22:02, edited 4 times in total.
Re: rule to control relay
Please attach files or screenshots in this forum, not on external, usually unreliable, image storage. After a while they won't be available anymore, so we can't see what was going on.
And rules can be added in a [ code ] [ /code ] tag (without the spaces, I added these so it will show here)
/Ton (PayPal.me)
Re: rule to control relay
Sending data to Domoticz is (much) easier by using a Controller, preferably the Domoticz MQTT controller, but you will need a MQTT server too (Mosquitto is often used in combination with Domoticz). Domoticz HTTP will do fine too.
/Ton (PayPal.me)
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
Re: rule to control relay
I have msqt too .
i have some sensors in the house.
termostat
some shelly 2.5 the control some blinds.
Outside i want to control 1 electrovalve to open/close the water when the soil is to dry. i have the info, but i do not know to make the next step.
i do not know how to configure the rule
i atached the file whit the img.
Thx
i have some sensors in the house.
termostat
some shelly 2.5 the control some blinds.
Outside i want to control 1 electrovalve to open/close the water when the soil is to dry. i have the info, but i do not know to make the next step.
i do not know how to configure the rule
i atached the file whit the img.
Thx
Re: rule to control relay
You can extend the current rule with what I posted before (cleaned it up a bit), that would then be like this:
NB: Each Rules set can contain multiple rules, a new rule starts with 'on <event> do', and ends with 'endon'
Code: Select all
on Soil#Analog do // Values are passed via %eventvalue1%..%eventvalue4%, and %eventvalue% is an alias for %eventvalue1%
SendToHTTP,192.168.0.115,8080,/json.htm?param=udevice&type=command&idx=26&nvalue=%eventvalue1%
if %eventvalue% < 1 // A bit dry, turn water pump on
SendToHTTP,192.x.x.x,80,/cm?cmnd=Power%20ON // Turn Tasmota relay on
endif
if %eventvalue1% > 3 // Wet enough, water pump off
SendToHTTP,192.x.x.x,80,/cm?cmnd=Power%20OFF // Turn Tasmota relay off
endif
endon
/Ton (PayPal.me)
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
Re: rule to control relay
And....
it's Workig !!
THX !!!
Now, i just find the corect value when the relay must be on/off.
thx again !!!!!
it's Workig !!
THX !!!
Now, i just find the corect value when the relay must be on/off.
thx again !!!!!
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
Re: rule to control relay
Hello again,
the rule made by you works very well. in this way thank you once again.
because the water pressure does not allow I would like to make 2 zones (zone 1 and zone 2) each zone controlled by a 1 relay, but not to run simultaneously. Can you help me change my rule so that
SendToHTTP, 192.x.x.ZZZ, 80, / cm? Cmnd = Power% 20ON // Turn Tasmota relay on
endif
to send the same order to another IP 192.x.x. YYY , but with a delay of 30 minutes?
Thank you,
the rule made by you works very well. in this way thank you once again.
because the water pressure does not allow I would like to make 2 zones (zone 1 and zone 2) each zone controlled by a 1 relay, but not to run simultaneously. Can you help me change my rule so that
SendToHTTP, 192.x.x.ZZZ, 80, / cm? Cmnd = Power% 20ON // Turn Tasmota relay on
endif
to send the same order to another IP 192.x.x. YYY , but with a delay of 30 minutes?
Thank you,
Re: rule to control relay
That should be doable, just to be sure: The seconds relay should be turned on 30 min. after the first is turned on, and also off again 30 minutes after the first is turned off?
Another solution could be to start the second pump after the first one stops, and run it for the same amount of time, if you need that, just ask.
Code: Select all
on Soil#Analog do // Values are passed via %eventvalue1%..%eventvalue4%, and %eventvalue% is an alias for %eventvalue1%
SendToHTTP,192.168.0.115,8080,/json.htm?param=udevice&type=command&idx=26&nvalue=%eventvalue1%
if %eventvalue% < 1 // A bit dry, turn water pump on
SendToHTTP,192.x.x.x,80,/cm?cmnd=Power%20ON // Turn Tasmota relay on
TimerSet,1,1800 // Timer in seconds, 30m * 60 sec.
endif
if %eventvalue1% > 3 // Wet enough, water pump off
SendToHTTP,192.x.x.x,80,/cm?cmnd=Power%20OFF // Turn Tasmota relay off
TimerSet,2,1800 // Timer in seconds, 30m * 60 sec.
endif
endon
on rules#timer=1 do
SendToHTTP,192.x.x.yyy,80,/cm?cmnd=Power%20ON // Turn second Tasmota relay on
endon
on rules#timer=2 do
SendToHTTP,192.x.x.yyy,80,/cm?cmnd=Power%20OFF // Turn second Tasmota relay off
endon
/Ton (PayPal.me)
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
Re: rule to control relay
THX!
i gone try like this !
i gone try like this !
-
- New user
- Posts: 7
- Joined: 01 May 2021, 15:40
Re: rule to control relay
Hello,
Thank you for your effort. I eventually used variant number 1. in the meantime I discovered that in "domoticz" I can make rules. I used the rule there, which I find easier.
thanks again for your help.
for the delay I used the delay option.
Thank you for your effort. I eventually used variant number 1. in the meantime I discovered that in "domoticz" I can make rules. I used the rule there, which I find easier.
thanks again for your help.
for the delay I used the delay option.
- Attachments
-
- delay.jpg (38.92 KiB) Viewed 6354 times
-
- qqqq.jpg (55.9 KiB) Viewed 6354 times
Re: rule to control relay
Great, a solution is a solution thanks for reporting back
/Ton (PayPal.me)
Who is online
Users browsing this forum: Bing [Bot] and 35 guests