OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Get and Display Rain Sensor › Re: Re: Get and Display Rain Sensor
Dan in CA
Denny,
Cool, Glad to see you have it working.
The only problem with putting the
gv.sd=getRainState()
where you have it is that it will be missed if a program is already running. You could put it at the start of the loop before the preceding “if” statement or at the end just before the
time.sleep(1)
where the rain delay stuff is and it will get checked once per second.
In the process of adding some rain sensor logic to the program I added:
if program_running:
if gv.sd and gv.sd: # Stop stations if use rain sensor and rain detected.
stop_stations()
In the main loop at ~line 235 in my version, and also:
if gv.sd: # Skip if rain delay
return
if gv.sd and gv.sd: # Skip if use rain sensor and rain detected.
return
in the schedule_stations function.
I will include this in the next update as it is similar to what the Arduino based OpenSprinkler does. I don’t know how many folks will add a rain sensor to their system so I won’t do much more than that for now but I will be glad to work with you to get the more advanced selective feature going.
You describe it as a per program selection but I think a per zone/station selection would be doable .
Dan