tank cooler
Moderators: grovkillen, Stuntteam, TD-er
tank cooler
Hello everyone I need help with the rules to create a tank cooler.
I would like :
- if temperature> 27 ° C (including 28, 29, 30, 31, ...)
- Then activate relays 1 and 2
- Wait 30 seconds
- relay 1 remains activated and relay 2 must deactivate
this opens an electric water valve.
Once the tank temperature <22 ° C, you must:
- Relay 1 must be deactivated
- Relay 2 activated
- Wait 30 seconds
- deactivate relay 2 and relay 1 too
If anyone can help me write the rules
Thank you
I would like :
- if temperature> 27 ° C (including 28, 29, 30, 31, ...)
- Then activate relays 1 and 2
- Wait 30 seconds
- relay 1 remains activated and relay 2 must deactivate
this opens an electric water valve.
Once the tank temperature <22 ° C, you must:
- Relay 1 must be deactivated
- Relay 2 activated
- Wait 30 seconds
- deactivate relay 2 and relay 1 too
If anyone can help me write the rules
Thank you
Re: tank cooler
First of all the most important link:
https://espeasy.readthedocs.io/en/lates ... Rules.html
- TimerSet command: https://espeasy.readthedocs.io/en/lates ... html#timer
You should trigger on the task value update event.
E.g. if you use a temp sensor on a task named "tank" with value name "temp", you get something like this in the rules:
However, you must realize that the temperature may fluctuate and also that it may take a while for a temperature to drop.
So I added flags to prevent the timer to be restarted on every read of the temperature sensor.
But it may not be sufficient yet as the temperature may fluctuate and thus restart the timer.
You have to think for yourself if that's what you need to happen.
https://espeasy.readthedocs.io/en/lates ... Rules.html
- TimerSet command: https://espeasy.readthedocs.io/en/lates ... html#timer
You should trigger on the task value update event.
E.g. if you use a temp sensor on a task named "tank" with value name "temp", you get something like this in the rules:
Code: Select all
on tank#temp do
if %eventvalue1% > 27
if [int#2] = 0
let,2,1 // Set flag to prevent resetting the timer
// Activate relay1 (e.g. using "Gpio" command)
// Activate relay2 (e.g. using "Gpio" command)
timerSet,2,30 // Set timer #2 for 30 sec to deactivate relay 2
endif
endif
if %eventvalue1% < 22
if [int#1] = 0
let,1,1 // Set flag to prevent resetting the timer
// Deactivate relay 1 (e.g. using "Gpio" command)
// Activate relay 2 (e.g. using "Gpio" command)
timerSet,1,30 // Set timer #1 for 30 sec to deactivate both relays
endif
endif
endon
On Rules#Timer=1 do
let,1,0 // clear the flag
// Deactivate relay 1 (e.g. using "Gpio" command)
// Deactivate relay 2 (e.g. using "Gpio" command)
endon
On Rules#Timer=2 do
let,2,0 // clear the flag
// deactivate relay 2 (e.g. using "Gpio" command)
endon
So I added flags to prevent the timer to be restarted on every read of the temperature sensor.
But it may not be sufficient yet as the temperature may fluctuate and thus restart the timer.
You have to think for yourself if that's what you need to happen.
Last edited by TD-er on 01 Jun 2021, 11:52, edited 1 time in total.
Reason: Clearing the flag....
Reason: Clearing the flag....
Re: tank cooler
@TD-er: You didn´t clear the flag....
It should be: let,1,0 and let,2,0
It should be: let,1,0 and let,2,0
Re: tank cooler
Sure I do now
Thanks... Wasn't clear in my head anymore I guess.
Re: tank cooler
Thanks for your help. I tried to adapt the code with the name of my sensors.
I pasted the code but it doesn't work.
I modified
"on tank#temp" do by "on sonde#temp do"
"if %eventvalue1% > 27" by "if %sonde#temp% > 27
"if [int#2] = 0 " do we need to change?
" let,2,1" do we need to change?
Sorry I am really a beginner and even reading the manual I do not understand anything
Here is the code modified :
I pasted the code but it doesn't work.
I modified
"on tank#temp" do by "on sonde#temp do"
"if %eventvalue1% > 27" by "if %sonde#temp% > 27
"if [int#2] = 0 " do we need to change?
" let,2,1" do we need to change?
Sorry I am really a beginner and even reading the manual I do not understand anything
Here is the code modified :
Code: Select all
on sonde#temp do
if %sonde#temp% > 27
if [int#2] = 0
let,2,1 // Set flag to prevent resetting the timer
gpio,12,0 // Activate relay1 (e.g. using "Gpio" command)
gpio,13,0 // Activate relay2 (e.g. using "Gpio" command)
timerSet,2,5 // Set timer #2 for 30 sec to deactivate relay 2
endif
endif
if %sonde#temp% < 25
if [int#1] = 0
let,1,1 // Set flag to prevent resetting the timer
gpio,12,0 // Deactivate relay 1 (e.g. using "Gpio" command)
gpio,13,1 // Activate relay 2 (e.g. using "Gpio" command)
timerSet,1,5 // Set timer #1 for 30 sec to deactivate both relays
endif
endif
endon
On Rules#Timer=1 do
let,1,0 // clear the flag
gpio,12,0 // Deactivate relay 1 (e.g. using "Gpio" command)
gpio,13,0 // Deactivate relay 2 (e.g. using "Gpio" command)
endon
On Rules#Timer=2 do
let,2,0 // clear the flag
gpio,13,0 // deactivate relay 2 (e.g. using "Gpio" command)
endon
Re: tank cooler
That change should be reverted, as %eventvalue1% is the correct variable, the first argument passed on to the event.
Also, you seem to try to both activate and de-activate a relay by setting the gpio to 0, I assume that de-activating should be done by setting the gpio to 1, for example:
Code: Select all
On Rules#Timer=2 do
let,2,0 // clear the flag
gpio,13,1 // deactivate relay 2 by setting the gpio to 1 (it seems setting it to 0 activates it?)
endon
/Ton (PayPal.me)
Re: tank cooler
Thanks you.
The program does not work correctly, relay 1 flashes when the temperature > 27 degrees et < 22 degrees
I give a diagram to make it easier to understand what I need
At start-up : Relay 1 = 1 (for 30s while the valve closes)
Relay 2 = 0
If temperature > 27 : Relay 1 = 1 (for 30s while the valve is opening)
Relay 2 = 1
If temperature < 22 : Relay 1 = 1 (for 30s while the valve closes)
Relay 2 = 0
to simplify the program, relay 1 must be activated for 30 seconds at each change of state of relay 2 and at start-up
if water leak at the water valve, I want to cut the 220v to remove the danger with the water. that's why I want a 30 second timeout
Maybe it's not possible to create ? or that you have another idea
Thank you
The program does not work correctly, relay 1 flashes when the temperature > 27 degrees et < 22 degrees
I give a diagram to make it easier to understand what I need
At start-up : Relay 1 = 1 (for 30s while the valve closes)
Relay 2 = 0
If temperature > 27 : Relay 1 = 1 (for 30s while the valve is opening)
Relay 2 = 1
If temperature < 22 : Relay 1 = 1 (for 30s while the valve closes)
Relay 2 = 0
to simplify the program, relay 1 must be activated for 30 seconds at each change of state of relay 2 and at start-up
if water leak at the water valve, I want to cut the 220v to remove the danger with the water. that's why I want a 30 second timeout
Maybe it's not possible to create ? or that you have another idea
Thank you
- Attachments
-
- IMG_8746.jpg (685.12 KiB) Viewed 11408 times
Re: tank cooler
Just one thing to watch out for... the "on" state for both relays differs.
This is something that's very easy to overlook when debugging. Especially for relay 2, it is the inverse of what you would expect.
This is something that's very easy to overlook when debugging. Especially for relay 2, it is the inverse of what you would expect.
Re: tank cooler
Okay, can you change the existing code?
thank you so much
thank you so much
Who is online
Users browsing this forum: No registered users and 22 guests