Helloz...I'm looking at automating my Water motor. At my place, Public Water supply is provided by our Municipal Corp. at set times. We have water motors at every house to pump the water to our Rooftop Water tanks from where it is distributed within the house.
I want to:
1. I have 4 Sensors in my water tank placed at different levels in the Water tank ( At 0%, 50%, 100% and Water Pump Intake Pipe)
2. I have connected above sensors to my Raspberry Pi to GPIO pins so they trigger the following named switches in Domoticz - 'Low', 'Med', 'High' and
'Waterin' respectively.
3. I want the water Motor to start daily from 6 AM to 7 AM and 6 PM to 7 PM only when Water in tank is Less than 100 and 50% and 0% (so Motor will only start when Water % is less than 100% in the tank) and when it's the time for the Public Water Supply times (ie. from 6-7 AM and 6-7 PM)
4. Finally in the scenario when No water is being pumped during above conditions (no water in the Public Supply but still Daily water time of 6-7 AM and PM) - the motor should stop and check periodically and start / Stop motor.
I have tried Blocky for below requirements, But I feel that it's more complicated and the answer to my requirements is in dzVents only....Requesting my Fellow Domoticz Enthusiasts to help me here...
Thanks
Regards
T
Water Motor Automation
Moderator: leecollings
-
- Posts: 5
- Joined: Friday 19 October 2018 8:44
- Target OS: -
- Domoticz version:
- Contact:
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Water Motor Automation
If I understood your setup and requirements correctly the dzVents code below should work for you.tango156157 wrote: ↑Monday 24 December 2018 17:50 Helloz...I'm looking at automating my Water motor. At my place, Public Water supply is provided by our Municipal Corp. at set times. We have water motors at every house to pump the water to our Rooftop Water tanks from where it is distributed within the house.
Code: Select all
-- waterTank.lua for dzVents >= 2.4
--[[
We have water motors at every house to pump the water to our Rooftop Water tanks from where it is distributed within the house.
1. I have 4 Sensors in my water tank placed at different levels in the Water tank ( At 0%, 50%, 100% and Water Pump Intake Pipe)
2. I have connected above sensors to my Raspberry Pi to GPIO pins so they trigger the following named switches in Domoticz - 'Low', 'Med', 'High' and
'Waterin' respectively.
3. I want the water Motor to start daily from 6 AM to 7 AM and 6 PM to 7 PM only when Water in tank is Less than 100 and 50% and 0% (so Motor will only start when Water % is less than 100% in the tank) and when it's the time for the Public Water Supply times (ie. from 6-7 AM and 6-7 PM)
4. Finally in the scenario when No water is being pumped during above conditions (no water in the Public Supply but still Daily water time of 6-7 AM and PM) - the motor should stop and check periodically and start / Stop motor.
]]--
local morning = "at 6:*" -- every minute between 6:00-7:00
local evening = "at 18:*" -- every minute between 18:00-19:00
local highSensor = "High"
local waterPump = "water Motor" -- change to name of motor device within quotes or id of motor device without quotes.
return {
on = { timer = { morning,evening },
devices = { highSensor }},
logging = { level = domoticz.LOG_DEBUG,
marker = "waterTank control" },
execute = function(dz, item)
tankFull = dz.devices(highSensor).state == "On"
pump = dz.devices(waterPump)
pumping = pump.state == "On"
if item.isTimer and dz.time.matchesRule("at *:59") and pumping then -- Pump timeslot ends. Stop pump (when pumping)
pump.switchOff()
elseif item.isTimer and not tankFull and not pumping then -- Pump timeslot
pump.switchOn()
elseif tankFull then -- triggered by highSensor
pump.switchOff()
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 5
- Joined: Friday 19 October 2018 8:44
- Target OS: -
- Domoticz version:
- Contact:
Re: Water Motor Automation
Many Thanks Waaren, I will try implementing the above script and let you know....
Wishing u a Happy New Year Ahead....
Wishing u a Happy New Year Ahead....
-
- Posts: 5
- Joined: Friday 19 October 2018 8:44
- Target OS: -
- Domoticz version:
- Contact:
Re: Water Motor Automation
So I tried above code which seems to work for my basic requirements of starting motor at said times, however still some tweaks required to the code based on observations:waaren wrote: ↑Monday 24 December 2018 21:08If I understood your setup and requirements correctly the dzVents code below should work for you.tango156157 wrote: ↑Monday 24 December 2018 17:50 Helloz...I'm looking at automating my Water motor. At my place, Public Water supply is provided by our Municipal Corp. at set times. We have water motors at every house to pump the water to our Rooftop Water tanks from where it is distributed within the house.
Code: Select all
-- waterTank.lua for dzVents >= 2.4 --[[ We have water motors at every house to pump the water to our Rooftop Water tanks from where it is distributed within the house. 1. I have 4 Sensors in my water tank placed at different levels in the Water tank ( At 0%, 50%, 100% and Water Pump Intake Pipe) 2. I have connected above sensors to my Raspberry Pi to GPIO pins so they trigger the following named switches in Domoticz - 'Low', 'Med', 'High' and 'Waterin' respectively. 3. I want the water Motor to start daily from 6 AM to 7 AM and 6 PM to 7 PM only when Water in tank is Less than 100 and 50% and 0% (so Motor will only start when Water % is less than 100% in the tank) and when it's the time for the Public Water Supply times (ie. from 6-7 AM and 6-7 PM) 4. Finally in the scenario when No water is being pumped during above conditions (no water in the Public Supply but still Daily water time of 6-7 AM and PM) - the motor should stop and check periodically and start / Stop motor. ]]-- local morning = "at 6:*" -- every minute between 6:00-7:00 local evening = "at 18:*" -- every minute between 18:00-19:00 local highSensor = "High" local waterPump = "water Motor" -- change to name of motor device within quotes or id of motor device without quotes. return { on = { timer = { morning,evening }, devices = { highSensor }}, logging = { level = domoticz.LOG_DEBUG, marker = "waterTank control" }, execute = function(dz, item) tankFull = dz.devices(highSensor).state == "On" pump = dz.devices(waterPump) pumping = pump.state == "On" if item.isTimer and dz.time.matchesRule("at *:59") and pumping then -- Pump timeslot ends. Stop pump (when pumping) pump.switchOff() elseif item.isTimer and not tankFull and not pumping then -- Pump timeslot pump.switchOn() elseif tankFull then -- triggered by highSensor pump.switchOff() end end }
1. The Water Motor starts but exactly after 1 Minute - the Water motor stops as next condition kicks in (If No Water is being pumped by motor at the water tank (this is picked up by a sensor connected to Raspberry Pi GPIO which gives condition of GPIO Pin in Closed state (Open signifies Water is being pumped into the water tank).
2. In the script below, I want the motor to be in "Off" condition for 2 minutes if there is no water being pumped to avoid a Dry Run state of the water motor, however this code also re-runs after exactly 1 minute and Water Motor turns on... This then becomes an endless loop till time conditions are true.
My modified code is as below:
local morning = "at 06:*" -- every minute between 6:00-7:00
local evening = "at 18:*" -- every minute between 18:00-19:00
local highSensor = "100" -- 100% Tank Full sensor connected via GPIO to Raspberry Pi
local waterPump = "WaterMotor" -- Water Motor Switch
local waterin = "WaterSensor" -- Water sensor placed in Water inlet pipe of the tank connected to water pump
return {
on = { timer = { morning,evening },
devices = { highSensor,waterin }},
logging = { level = domoticz.LOG_DEBUG,
marker = "waterTank control" },
execute = function(dz, item)
tankFull = dz.devices(highSensor).state == "Open"
pump = dz.devices(waterPump)
pumping = pump.state == "On"
wateryes = dz.devices(waterin).state == "Open" -- Open is Water is getting pumped and Closed is no water getting pumped
if item.isTimer and dz.time.matchesRule("at *:59") and pumping then -- Pump timeslot ends. Stop pump (when pumping)
pump.switchOff()
elseif item.isTimer and not tankFull and not pumping then -- Pump timeslot
pump.switchOn()
elseif tankFull then -- triggered by highSensor
pump.switchOff()
elseif item.isTimer and not wateryes then
pump.switchOff().forMin(2)
end
end
}
Who is online
Users browsing this forum: No registered users and 1 guest