OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Water pump is shared between pool and sprinklers – manual pool filling? Reply To: Water pump is shared between pool and sprinklers – manual pool filling?

#38504

Axel
Participant

I received my valves and 24 VAC power supply yesterday and started coding today.

My workaround is to define a disabled program called “Rain Sensor” that is run when the rain sensor goes from clear to set. This program will run station 2 for 12 hours which is approximately how long it takes to go from totally empty to totally full in my 80,000 liter swimming pool. This program stops due to 12h timeout or due to a rain sensor transition from set to clear.

This works ok in my “lab” but I am a bit worried about the side effects of playing with the os.status.rain_sensed flag and calling reset_all_stations() which seems to clear the queue. Will this affect the schedule for the rest of the day? I plan to have ospi querying wunderground for rain info. Do you have any tips?

Here’s the relevant code:

    ProgramStruct rainprog;
    if (os.old_status.rain_sensed != os.status.rain_sensed) {
      if (os.status.rain_sensed) {
        // rain sensor on, record time
        os.rainsense_start_time = curr_time;

        for( int rainpid=1;rainpid<255;++rainpid){
          pd.read(rainpid-1, &rainprog);
          if(strstr(rainprog.name,"Rain Sensor")){
            manual_start_program(rainpid);
            break;
          }
        }
      }else{
        // rain sensor off, write log
        write_log(LOGDATA_RAINSENSE, curr_time);
        reset_all_stations();
      }
      os.old_status.rain_sensed = os.status.rain_sensed;
    }

I also noticed that if I stop the service using /etc/init.d/OpenSprinker.sh stop, the valves are left open. This will flood my garden. How do I stop this from happening? We probably need to use the RPi watchdog.