Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Details for how Rain Sensor works
#1
I have a Hunter C300 Pro system that I have done a bypass on using a relay board and SIP as the control. I have turned the Hunter box to off and tied the wires from the relay board into the Hunter breakout section. Everything is working fine, but I don't have a GPIO port on the computer that is running SIP.  I do have Weewx weather station setup that gives me rain totals and current rain rate every 5 minutes. Is there a way to change SIP to use the station data  to replace the Rain sensor input?

As to how the sensor works. Does SIP just stop the irrigation if the rain sensor is triggered and then allow it to run after the rain, kind of like the rain delay function described in the user guide, or does it skip irrigation for the day that the rain sensor is triggered? I dug around the docs and code as best I could but could not understand how it worked. I'm pretty good at bash scripting but not the best at python as yet.

Thanks for the help
Reply
#2
If a rain sensor is connected to SIP running on a Raspberry Pi it will stop irrigation as long as the rain sensor's switch is active.  It is possible to set some stations to ignore the rain sensor or a rain delay on the Stations page.

Internally SIP has 2 variables that control the effect of the rain sensor. They are gv.sd["urs"] (use rain sensor) and gv.sd["rs"] (rain sensed) if both of those variables have a value of 1 irrigation will be stopped. You can find descriptions of the SIP variables in the gv_reference.txt file in the SIP directory.

Currently there is a new SIP extension (plugin) under development that integrates Node-RED with SIP. It will allow node-red to read and set almost all of SIP's variables. That may be something you could use.

Dan
<p><br></p>
Reply
#3
(2022 Oct 25, 09:57 PM)dan Wrote: If a rain sensor is connected to SIP running on a Raspberry Pi it will stop irrigation as long as the rain sensor's switch is active.  It is possible to set some stations to ignore the rain sensor or a rain delay on the Stations page.

Internally SIP has 2 variables that control the effect of the rain sensor. They are gv.sd["urs"] (use rain sensor) and gv.sd["rs"] (rain sensed) if both of those variables have a value of 1 irrigation will be stopped. You can find descriptions of the SIP variables in the gv_reference.txt file in the SIP directory.

Currently there is a new SIP extension (plugin) under development that integrates Node-RED with SIP. It will allow node-red to read and set almost all of SIP's variables. That may be something you could use.

Dan

When both variables are true and irrigation is scheduled or in progress is irrigation delayed or just ended for the day? Currently I have a bash script that gets the rain total and rain rate data from my station and uses web interface cmds to disable or enable the SIP system. If rain is happening during a scheduled irrigation program which has sequential station durations what happens to that program? A) if the rain sensor GPIO is active or B)if I have issued a system off web cmd. Particularly if the rain ends before the program end time. My guess in either case the program is stopped and the remainder of the program ignored for the day if “rain sensed” and “use rain sensor” are active and if system off is active at start of program or issued during the program, the program or it’s remainder is ignored for the day as well. Is that correct?

Bryan
Reply
#4
(2022 Oct 26, 02:56 AM)tutqiunnh Wrote:
(2022 Oct 25, 09:57 PM)dan Wrote: If a rain sensor is connected to SIP running on a Raspberry Pi it will stop irrigation as long as the rain sensor's switch is active.  It is possible to set some stations to ignore the rain sensor or a rain delay on the Stations page.

Internally SIP has 2 variables that control the effect of the rain sensor. They are gv.sd["urs"] (use rain sensor) and gv.sd["rs"] (rain sensed) if both of those variables have a value of 1 irrigation will be stopped. You can find descriptions of the SIP variables in the gv_reference.txt file in the SIP directory.

Currently there is a new SIP extension (plugin) under development that integrates Node-RED with SIP. It will allow node-red to read and set almost all of SIP's variables. That may be something you could use.

Dan

When both variables are true and irrigation is scheduled or in progress is irrigation delayed or just ended for the day? Currently I have a bash script that gets the rain total and rain rate data from my station and uses web interface cmds to disable or enable the SIP system. If rain is happening during a scheduled irrigation program which has sequential station durations what happens to that program? A) if the rain sensor GPIO is active or B)if I have issued a system off web cmd. Particularly if the rain ends before the program end time. My guess in either case the program is stopped and the remainder of the program ignored for the day if “rain sensed” and “use rain sensor” are active and if system off is active at start of program or issued during the program, the program or it’s remainder is ignored for the day as well. Is that correct?

Bryan
You are basically correct.

To make things a little clearer here are some more details about how SIP works:

First, I forgot to mention that there is a third variable gv.sd["rst"] (rain sensor type).
If "use rain sensor" is set on the Options page. You can simulate a rain sensor by toggling between gv.sd["rst"] = 0 and gv.sd["rst"] = 1. You mentioned that you are not using GPIO pins for the rain sensor so this may be useful.

When the system is disabled everything stops. Any running stations are stopped and no new programs will be scheduled.
There is also "stop all stations" (command: /cv?rsn=1) which stops any running stations and clears the schedule of the currently running program. Programs that are scheduled later will still be run.

At this point there is no way to delay a program it is just ended. Delaying a program would interfere with any programs scheduled at a later time so it would be problematic.

When a rain sensor is connected to a GPIO pin and the sensor's switch is active, irrigation is stopped and no further irrigation is allowed except for stations that are set to ignore rain.

The way a rain sensor works is that is has a stack of absorbent disks that swell when they get wet. When they swell a certain amount it activates the switch. When the rain stops it takes a while for the disks to dry and contract enough to release the switch. This is designed to simulate the moisture content of the soil.

Dan
<p><br></p>
Reply
#5
Thanks for the clarification, much appreciated. SIP is a very flexible well thought out application.
Reply
#6
(2022 Oct 25, 09:57 PM)dan Wrote: If a rain sensor is connected to SIP running on a Raspberry Pi it will stop irrigation as long as the rain sensor's switch is active.  It is possible to set some stations to ignore the rain sensor or a rain delay on the Stations page.

Internally SIP has 2 variables that control the effect of the rain sensor. They are gv.sd["urs"] (use rain sensor) and gv.sd["rs"] (rain sensed) if both of those variables have a value of 1 irrigation will be stopped. You can find descriptions of the SIP variables in the gv_reference.txt file in the SIP directory.

Currently there is a new SIP extension (plugin) under development that integrates Node-RED with SIP. It will allow node-red to read and set almost all of SIP's variables. That may be something you could use.

Dan

Dan,

   I have been hacking away at creating a plugin for doing rain detect using my weewx weather station for weather data. I have a bash shell script that works by issuing system on/off commands via HTTP GET interface. I have a basic python plugin up and running that checks weather station data and uses it against thresholds set to adjust water level (u"wl") similar to the weather_level_adj plugin. This seems to work for looking at total past rain amounts, forecast rain, and low temperature detection to disable watering. However, if the stations are running and rain is detected during the run adjusting u"wl" does not stop the running stations/programs. I have looked at the check_rain() subroutine in helpers.py and even if I were to set u"rs" with my plugin, check_rain() would override this by trying to check GPIO pins for a rain sensor. I'm trying to find a good work around, but have failed. I have looked at u"rd" (rain delay) but I think it just delays the program/stations for a time delay set via the web page. It seems like I would have to hack the check_rain() subroutine to allow non-GPIO based inputs for rain detect. Maybe the Node-RED update might help, but I'm not sure. Appreciate any thoughts.

PS (as a pleb, the proto stuff was a very good start to getting things up and running, greatly appreciated)

Thanks,
  Bryan
Reply
#7
Bryan ,

Sounds like what you are looking for to stop running stations is the "stop_stations()" function from the helpers python  module in SIP. Or the GET command  "/cv?pw=xxx{&rsn=1}".

These have the same effect as clicking the "'stop all stations" button on the SIP home page. It stops any running stations until the next scheduled run occurs. If the rain sensor is active when the next program is scheduled it will not run.

Dan
<p><br></p>
Reply
#8
(2023 May 28, 01:45 PM)dan Wrote: Bryan ,

Sounds like what you are looking for to stop running stations is the "stop_stations()" function from the helpers python  module in SIP. Or the GET command  "/cv?pw=xxx{&rsn=1}".

These have the same effect as clicking the "'stop all stations" button on the SIP home page. It stops any running stations until the next scheduled run occurs. If the rain sensor is active when the next program is scheduled it will not run.

Dan

Dan,

   Thanks for the response. So in my plugin I just use "from helpers import stop_stations" and then just execute that based on a logical check inside my plugin if I have rain detection from the weather station. Sounds great, thanks again.

Bryan
Reply
#9
Dan,

   I know it has been a while. I have been taking another look at the rain sensor function when I'm "faking" it from my weather station. When I look at helpers.py function check_rain() it only works if I have GPIO module loaded so I can't see how the u"rst = 1, u"rst=0 toggle can "fake" a rain sensor. Can you explain so I understand what I'm missing.
If that really doesn't work, my ubuntu system has no GPIO, but  I can fake that with fake_rpigpio module installation. However, for GPIO.input statements in check_rain it sends a random 1 or 0 output.

   Anyway, I think I can get around that if I'm able to determine that I have the proper plugin loaded and can pass that plugin info as a global to helpers.py check_rain to use an if so that if fake_gpio and the plugin are loaded go aroung the gpio. How would I determine if a certain plugin is loaded in helpers.py I have tried "import plugins" but that doesn't work due to circular imports with sip.py. Is there a gv variable that shows the installed plugins that I can check?

Thanks for the help.

Best,
Bryan
Reply
#10
Hi Brian,

There are a couple of vars that you may be able to use.

They are listed in the updated gv_reference in the SIP wiki:
https://raw.githubusercontent.com/wiki/D...erence.pdf

First is the "rs" var under "from options:"

Also there are "gv.plugin_data" and "gv.plugin_menu" under "Read only (status info):"

Dan
<p><br></p>
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)