def execute_command(self, command): LOGGER.debug('executing %s', command) try: self.deviceDriver.executeCommand(command['cmd'], command.get('value')) self.refresh_state() except: LOGGER.exception('Error sending command to ' + self.name)
def refresh_state(self): if self.primaryDevice.connected: LOGGER.debug('Refreshing state for %s', self.name) try: for driverName, commandName in self.driverSetters.items(): output = self.deviceDriver.getData(commandName) result = output.get('result') if result is not None: self.setDriver(driverName, float(result)) except: LOGGER.exception('Error refreshing %s device state', self.name)
def execute_command(self, command): try: LOGGER.debug('Device %s executing command %s', self.name, command['cmd']) self.deviceDriver.executeCommand( self.prefix + command['cmd'] + self.suffix, command.get('value')) time.sleep(1) self.refresh_state() except: LOGGER.exception('Error sending command to ' + self.name)