OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) rain sensor signaling Reply To: rain sensor signaling


Dan in CA

Hi Sean,

You are correct that this signal does not presently exist. It would be useful so I plan to added it.

To make it work you would add something like:

from blinker import signal

rain_sensed = signal('rain')
def signal_rain():

near the start of (just before the function definitions section).
you could then add the signal_rain() function when setting[‘rn’]= 1 as you said but when I tested this it sent the signal once per second.

if not['rs']:

will only send one signal when rain is detected.

To use the signal you will also need to have something like:

def do_on_rain(name, **kw):
    print "Rain Sensed"
    #  rain is detected in
    # Put your code here to do whatever you want. 
rain_sensed = signal('rain')

Those last 2 lines will trigger your “do_on_rain()” function when the signal is received.