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)
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)
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
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)
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)