Posts: 4
Threads: 1
Joined: Apr 2016
Reputation:
0
Hi,
My sprinkler system uses both cistern and city water. I'd like to use the cistern water until empty and then switch to city water.
If the system is running I need to check once per minute to see if the cistern still has water (I already have a way to test this) and turn on the city water if not. I'd also like to ensure that the city water value is closed and cistern pump off if the system isn't running.
What are your thoughts on the best way to implement?
Thanks,
Tim
Posts: 652
Threads: 18
Joined: Aug 2015
Reputation:
22
2016 May 13, 10:02 PM
(This post was last modified: 2016 May 13, 10:09 PM by dan.)
An interesting situation.
Could you provide a bit more information about your system such as the type of sensor you use to check the cistern level (switch or continuous levell sensor).
Do you have a sensor of some sort on the city water side such as a pressure sensor?
How many stations are you running?
SIP has a signaling system that can be used to run code when a station is on. See the signaling_examples.py file in the plugins directory.
Are you familiar with Python programming?
Posts: 4
Threads: 1
Joined: Apr 2016
Reputation:
0
Thanks Dan.
> Could you provide a bit more information about your system such as the type of sensor you use to check the cistern level (switch or continuous levell sensor).
In the cistern I have a number of float switches. I have a simple REST interface to request the current water level (and in this case I only care about "empty").
>Do you have a sensor of some sort on the city water side such as a pressure sensor?
On the city side I have a valve and and a flow sensor. Again, simple REST interface to check the status of the valve and water flow.
> How many stations are you running?
I am running 15 stations.
>SIP has a signaling system that can be used to run code when a station is on.
Yes, I've seen the signals in the sample plugins and when running sip.py manually. I see the plugins with a "while True" loop/sleep. Is that a reasonable way to implement? I'm just a bit confused about having my loop only run if a zone is active.
I am familiar with Python though not a sw developer by any stretch.
THANKS!
Posts: 652
Threads: 18
Joined: Aug 2015
Reputation:
22
2016 May 14, 01:25 AM
(This post was last modified: 2016 May 14, 01:28 AM by dan.)
So does your REST code allow to control things or just report status?
Just off the top of my head:
Using the signaling in SIP you could do something like:
def notify_zone_change(name, **kw):
running = any(gv.srvals) # gv.srvals shows the state of the zones as a list with 1's for zones that are on an 0's for ones that are off.
loop()
def loop():
global running
while running:
your loop code
Posts: 4
Threads: 1
Joined: Apr 2016
Reputation:
0
Thanks Dan. Due to interactions with other systems I've decided to solve this outside of SIP. I am still a bit confused about loop(). In your sketch I didn't have much luck with interaction between notify_zone_change and loop. Even when the zones were all off running appeared to remain true.
Best,
Tim
Posts: 4
Threads: 1
Joined: Apr 2016
Reputation:
0
Thanks for the example Dan. It worked perfectly for me.