コード例 #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)
コード例 #2
0
ファイル: rest_service.py プロジェクト: bobhelander/house
 def PUT(self, zone, state):
     return json.dumps(sprinkler.sprinkler_control(zone=zone,
                                                   state=state,
                                                   host=SETTINGS.get("irrigation", "irrigation_host"),
                                                   port=SETTINGS.get("irrigation", "irrigation_port")))