Esempio n. 1
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)
Esempio n. 2
0
 def PUT(self, milliseconds):
     return json.dumps(sprinkler.sprinkler_start_cycle(milliseconds=milliseconds,
                                                       host=SETTINGS.get("irrigation", "irrigation_host"),
                                                       port=SETTINGS.get("irrigation", "irrigation_port")))