Exemplo n.º 1
0
    def _actuate(self, obj, action):
        """
            obj: valve object
            action: str,  "Open" or "Close"
        """
        if self.simulation:
            return True

        cmd = '{} {}'.format(action, get_valve_address(obj))
        return self.ask(cmd)
Exemplo n.º 2
0
    def get_indicator_state(self, obj, action='open', verbose=False):
        """
        returns True if open and False if closed.

        :param obj:
        :param action:
        :param verbose:
        :return:
        """
        cmd = json.dumps({'command': 'GetIndicatorState',
                          'name': get_valve_address(obj),
                          'action': action})
        resp = self.ask(cmd, verbose=verbose)

        # if action == 'open':
        # print 'aa', resp, action
        if resp:
            resp = resp.strip()
            if resp == 'open':
                return True
            elif resp == 'closed':
                return False
Exemplo n.º 3
0
 def get_channel_state(self, obj, verbose=False):
     """
         Query the hardware for the channel state
     """
     cmd = 'GetChannelState {}'.format(get_valve_address(obj))
     return self.ask(cmd, verbose=verbose)
Exemplo n.º 4
0
 def get_indicator_state(self, obj, action='open', verbose=True):
     cmd = json.dumps({'command': 'GetIndicatorState',
                       'name': get_valve_address(obj),
                       'action': action})
     return self.ask(cmd, verbose=verbose)