def off(self): """Send the Off command to an X10 device.""" msg = X10Send.unit_code_msg(self.address.x10_housecode, self.address.x10_unitcode) self._send_method(msg) msg = X10Send.command_msg(self.address.x10_housecode, X10_COMMAND_OFF) self._send_method(msg, False) self._update_subscribers(0x00)
def x10_all_units_off(self, housecode): """Send the X10 All Units Off command.""" if isinstance(housecode, str): housecode = housecode.upper() else: raise TypeError('Housecode must be a string') msg = X10Send.command_msg(housecode, X10_COMMAND_ALL_UNITS_OFF) self.send_msg(msg) self._x10_command_to_device(housecode, X10_COMMAND_ALL_UNITS_OFF, msg)
def dim(self, defer_update=False): """Dim the device one step.""" msg = X10Send.unit_code_msg(self.address.x10_housecode, self.address.x10_unitcode) self._send_method(msg) msg = X10Send.command_msg(self.address.x10_housecode, X10_COMMAND_DIM) self._send_method(msg, False) if not defer_update: self._update_subscribers(self._value - 255 / self._steps)
def brighten(self, defer_update=False): """Brighten the device one step.""" msg = X10Send.unit_code_msg(self.address.x10_housecode, self.address.x10_unitcode) self._send_method(msg) msg = X10Send.command_msg(self.address.x10_housecode, X10_COMMAND_BRIGHT) self._send_method(msg, False) if not defer_update: self._update_subscribers(self._value + 255 / self._steps)
def x10_all_lights_on(self, housecode): """Send the X10 All Lights Off command.""" msg = X10Send.command_msg(housecode, X10_COMMAND_ALL_LIGHTS_ON) self.send_msg(msg) self._x10_command_to_device(housecode, X10_COMMAND_ALL_LIGHTS_ON, msg)