Example #1
0
def start_cycle(cycle_id, cycle_durations):
    """
    Opens a irrigation value for the cycle duration
    """
    update_status("Running Cycle")
    logging.debug("Starting Cycle: %s", cycle_id)
    date = datetime.now()
    add_cycle(cycle_id, date, str(cycle_durations))
    zone = 1
    for duration in cycle_durations:
        run_cycle(zone, duration)
        zone += 1
    
    # Be sure all zones are closed
    sprinkler_end_cycle()
    update_status("Finished Cycle")
    logging.debug("Finished Cycle: %s", cycle_id)
Example #2
0
def run_cycle(zone, duration):
    """
    Calls the start_cycle method and waits for completion
    """
    logging.debug("Starting Zone: %s Duration: %s", zone, duration)
    # Waiting for finish
    wait_for_cycle()
    # Shutdown all
    sprinkler_end_cycle()
    # Open zone valve
    if duration > 0:
        # Start cycle counter.  Do this before turning
        # on the zone.  This will prevent runaway watering.
        sprinkler_start_cycle(duration*1000*60)
        # Turn the zone on
        sprinkler_control(zone, "on")
        logging.debug("Zone On")        
    
    # Waiting for finish
    wait_for_cycle()
    logging.debug("Finished Zone: %s", zone)
Example #3
0
 def DELETE(self, milliseconds):
     return json.dumps(sprinkler.sprinkler_end_cycle(host=SETTINGS.get("irrigation", "irrigation_host"),
                                                     port=SETTINGS.get("irrigation", "irrigation_port")))