def load_outputs(self, fields=None): amount_output_modules = self._master_communicator.do_command( CoreAPI.general_configuration_number_of_modules(), {})['output'] outputs = [] for i in xrange(amount_output_modules * 8): outputs.append(self.load_output(i, fields)) return outputs
def _refresh_output_states(self): amount_output_modules = self._master_communicator.do_command(CoreAPI.general_configuration_number_of_modules(), {})['output'] for i in xrange(amount_output_modules * 8): state = self._master_communicator.do_command(CoreAPI.output_detail(), {'device_nr': i}) # TODO: also trigger callback when status changed without an event. self._output_states[i] = {'id': i, 'status': state['status'], # 1 or 0 'ctimer': state['timer'], 'dimmer': state['dimmer']} self._output_last_updated = time.time()
def _refresh_sensor_states(self): amount_sensor_modules = self._master_communicator.do_command(CoreAPI.general_configuration_number_of_modules(), {})['sensor'] for module_nr in xrange(amount_sensor_modules): temperature_values = self._master_communicator.do_command(CoreAPI.sensor_temperature_values(), {'module_nr': module_nr})['values'] brightness_values = self._master_communicator.do_command(CoreAPI.sensor_brightness_values(), {'module_nr': module_nr})['values'] humidity_values = self._master_communicator.do_command(CoreAPI.sensor_humidity_values(), {'module_nr': module_nr})['values'] for i in xrange(8): sensor_id = module_nr * 8 + i self._sensor_states[sensor_id] = {'TEMPERATURE': temperature_values[i], 'BRIGHTNESS': brightness_values[i], 'HUMIDITY': humidity_values[i]} self._sensor_last_updated = time.time()
def load_sensors(self, fields=None): amount_sensor_modules = self._master_communicator.do_command(CoreAPI.general_configuration_number_of_modules(), {})['sensor'] sensors = [] for i in xrange(amount_sensor_modules * 8): sensors.append(self.load_sensor(i, fields)) return sensors
def get_sensors_brightness(self): amount_sensor_modules = self._master_communicator.do_command(CoreAPI.general_configuration_number_of_modules(), {})['sensor'] brightnesses = [] for sensor_id in xrange(amount_sensor_modules * 8): brightnesses.append(self.get_sensor_brightness(sensor_id)) return brightnesses
def get_sensors_humidity(self): amount_sensor_modules = self._master_communicator.do_command(CoreAPI.general_configuration_number_of_modules(), {})['sensor'] humidities = [] for sensor_id in xrange(amount_sensor_modules * 8): humidities.append(self.get_sensor_humidity(sensor_id)) return humidities
def _enumerate_io_modules(self, module_type): cmd = CoreAPI.general_configuration_number_of_modules() module_count = self._master_communicator.do_command(cmd, {})[module_type] return xrange(module_count * 8)