Page 1 of 1
Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 12:38
by davidmarli
Hi,
In order to finish the implementation of the swimming pool heater, I need to turn on a switch for 2 minutes every 12 minutes from 10:00 to 18:00 every day.
How can I do that easily with domoticz ? And Is it possible ?
Thanks a lot.
Re: Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 12:52
by sijones
Possibly use a LUA script, checking time is between the hours, always turn on for 2 at 10:00 then if it's been 12 minutes since last update turn on for 2.
Re: Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 12:55
by jannl
Or via a shell (perl/python/..) script and a json call.
Re: Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 12:58
by Egregius
Isn't it better to use a water thermometer?
Re: Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 13:06
by radem205
Try the code below (not tested yet). You have to save the code as "script_time_whatever.lua" and put it in the scripts/lua directory. Or you can use the new build in lua script editor (select "Time" from the dropdown list to execute this script every minute).
Code: Select all
local switch = 'Switch name'
time = os.date("*t")
commandArray = {}
if time.hour > 10 and time.hour < 18 then
if time.min % 12 == 0 then
commandArray[switch] = 'On FOR 2'
end
end
return commandArray
Re: Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 16:10
by davidmarli
In fact I made two years ago a solar heater system. I'm oblige to make the water go through the pipe often : when the sun is ther in summer, if I let the water still in the pipe for 15 minutes, when I open it, the water exit the pipe at 70°C !!!
Once we left in hollidays, and I switch off the pump. When we came back, the pipe has melted !!!!
So I know it would be better to test the swimming pool water temperature and then decide if I have the turn on the pump of the heater, but I have no choice ...
What could I do, is to put a ds18b20 temperaure sensor INTO the pipe to have the real inside water temperature but ....
I will test the script.
Re: Turning on and off a switch every 10 minutes ?
Posted: Wednesday 03 February 2016 16:36
by oliviers
Hi,
Can't you just enter the 30 on/off commands in the switch planning ?
Oliviers