Hello,
I use a nodemcu to control the solar heating of my swimming pool.
I use a ds18b20 probe and a 2004 LCD
I would like to program an espeasy to trigger a pump when the water is over 45 but I must admit that I am as bad at English as I am at code.
For English it's fine there is google traslate, but for the code, I'm counting on you.
I did some research and I found this that I adapted with the gpios of my relay. But I'm not sure it's right and I'm missing some things for the display.
- If the temperature of the outlet sensor is > 45°C the pump starts and starts a second counter
- If the temperature of the outlet probe is < 30°C the pump stops and stops the second counter
- Display the circuit inlet and circuit outlet temperature on line 1 of the screen.
- Display the date and time on line 2 of the screen.
- We display the duration of one cycle in seconds on line 3 of the screen.
- Display the time of the last cycle on line 4 of the screen.
On Relay Off do
gpio,13.1
end
on RelayOn do
gpio,13.0
end
on ds18b20#temperature>45 do
RelayOn event
//start the second counter
end
on ds18b20#temperature<30 do
RelayOff event
// stop the second counter and put the result in a variable
// We display on line 3 the duration in seconds of the heating cycle
// We display the stop time on the screen on line 4
end
Thank's in advance for you help
Rule for control solar heating of my swimming pool
Moderators: grovkillen, Stuntteam, TD-er
Re: Rule for control solar heating of my swimming pool
First of all, I notice you're using the wrong syntax for a few things.
To fire an event, "event" is the command and the eventname is the argument.
=> event,RelayOn
Second, an eventname does not have a space in it.
=> On RelayOff do
Third, an "on...do" block is ended with "endon"
Fourth, the arguments of a command are separated by a comma, not a dot.
=> gpio,13,0
Just some other tip.
It is best to act on an event without the check for a value, like this:
Now the missing part of the timer.
One more thing, it is better to use asyncevent instead of event here.
So that's what I did in the example code (which is not tested)
To fire an event, "event" is the command and the eventname is the argument.
=> event,RelayOn
Second, an eventname does not have a space in it.
=> On RelayOff do
Third, an "on...do" block is ended with "endon"
Fourth, the arguments of a command are separated by a comma, not a dot.
=> gpio,13,0
Just some other tip.
It is best to act on an event without the check for a value, like this:
Code: Select all
on ds18b20#temperature do
if %eventvalue1% > 45
asyncevent,RelayOn
elseif %eventvalue1% < 30
asyncevent,RelayOff
// stop the second counter and put the result in a variable
// We display on line 3 the duration in seconds of the heating cycle
// We display the stop time on the screen on line 4
endif
endon
Code: Select all
On RelayOff do
gpio,13,0
timerSet,2,0 // stop the second counter
endon
on RelayOn do
gpio,13,0
timerSet,2,100 // start the second counter
// No idea how long this must be set, you decide
endon
on Rules#Timer=2 do
asyncevent,RelayOff
endon
So that's what I did in the example code (which is not tested)
Who is online
Users browsing this forum: No registered users and 104 guests