Esempio n. 1
0
    def set(self, mode):
        """Set the thermostat mode.

        Mode optons:
            OFF = 0x00,
            HEAT = 0x01,
            COOL = 0x02,
            AUTO = 0x03,
            FAN_AUTO = 0x04,
            FAN_ALWAYS_ON = 0x8
        """
        new_mode = None
        if mode == ThermostatMode.OFF:
            new_mode = COMMAND_THERMOSTAT_CONTROL_OFF_ALL_0X6B_0X09
        elif mode == ThermostatMode.HEAT:
            new_mode = COMMAND_THERMOSTAT_CONTROL_ON_HEAT_0X6B_0X04
        elif mode == ThermostatMode.COOL:
            new_mode = COMMAND_THERMOSTAT_CONTROL_ON_COOL_0X6B_0X05
        elif mode == ThermostatMode.AUTO:
            new_mode = COMMAND_THERMOSTAT_CONTROL_ON_AUTO_0X6B_0X06
        if new_mode:
            msg = ExtendedSend(address=self._address,
                               commandtuple=new_mode,
                               userdata=Userdata())
            msg.set_checksum()
            self._send_method(msg, self._mode_change_ack)
Esempio n. 2
0
 def off(self):
     """Turn off the fan."""
     off_command = ExtendedSend(self._address, COMMAND_LIGHT_OFF_0X13_0X00,
                                self._udata)
     off_command.set_checksum()
     self._send_method(off_command, self._off_message_received)
     _LOGGER.debug("Ending DimmableSwitch_Fan.off")
Esempio n. 3
0
    def _create_set_property_msg(self, prop, cmd, val):
        """Create an extended message to set a property.

        Create an extended message with:
            cmd1: 0x2e
            cmd2: 0x00
            flags: Direct Extended
            d1: group
            d2: cmd
            d3: val
            d4 - d14: 0x00

        Parameters:
            prop: Property name to update
            cmd: Command value
                0x02: on mask
                0x03: off mask
                0x04: x10 house code
                0x05: ramp rate
                0x06: on level
                0x07: LED brightness
                0x08: Non-Toggle mask
                0x09: LED bit mask (Do not use in this class. Use LED class)
                0x0a: X10 All bit mask
                0x0c: Trigger group bit mask
            val: New property value

        """
        user_data = Userdata({'d1': self.group, 'd2': cmd, 'd3': val})
        msg = ExtendedSend(self._address, COMMAND_EXTENDED_GET_SET_0X2E_0X00,
                           user_data)
        msg.set_checksum()
        self._set_sent_property(prop, val)
        return msg
Esempio n. 4
0
 def on(self):
     """Send an ON message to device group."""
     on_command = ExtendedSend(self._address,
                               COMMAND_LIGHT_ON_0X11_NONE,
                               self._udata,
                               cmd2=0xff)
     on_command.set_checksum()
     self._send_method(on_command, self._on_message_received)
Esempio n. 5
0
 def on(self):
     """Turn on the fan."""
     on_command = ExtendedSend(self._address,
                               COMMAND_LIGHT_ON_0X11_NONE,
                               self._udata,
                               cmd2=FAN_SPEED_MEDIUM)
     on_command.set_checksum()
     self._send_method(on_command, self._on_message_received)
Esempio n. 6
0
 def set(self, val):
     """Set the heat set point."""
     msg = ExtendedSend(
         address=self._address,
         commandtuple=COMMAND_THERMOSTAT_SET_HEAT_SETPOINT_0X6D_NONE,
         cmd2=int(val * 2),
         userdata=Userdata())
     msg.set_checksum()
     self._send_method(msg, self._set_heat_point_ack)
Esempio n. 7
0
 def extended_status_request(self):
     """Send status request for group/button."""
     self._status_received = False
     user_data = Userdata({'d1': self.group, 'd2': 0x00})
     cmd = ExtendedSend(self._address,
                        COMMAND_EXTENDED_GET_SET_0X2E_0X00,
                        userdata=user_data)
     cmd.set_checksum()
     self._send_method(cmd, self._status_message_received, True)
Esempio n. 8
0
    async def _send_led_on_off_request(self, group, val):
        _LOGGER.debug("OnOffKeypadLed._send_led_on_off_request was called")
        await self._send_led_change_lock
        self._new_value = set_bit(self._value, group, bool(val))

        user_data = Userdata({'d1': 0x01, 'd2': 0x09, 'd3': self._new_value})
        msg = ExtendedSend(self._address, COMMAND_EXTENDED_GET_SET_0X2E_0X00,
                           user_data)
        msg.set_checksum()
        self._send_method(msg, self._on_off_ack_received, True)
Esempio n. 9
0
 def set_level(self, val):
     """Set the fan speed."""
     speed = self._value_to_fan_speed(val)
     if val == 0:
         self.off()
     else:
         set_command = ExtendedSend(self._address,
                                    COMMAND_LIGHT_ON_0X11_NONE,
                                    self._udata,
                                    cmd2=speed)
         set_command.set_checksum()
         self._send_method(set_command, self._on_message_received)
Esempio n. 10
0
 def scene_off(self):
     """Trigger group/scene to OFF level."""
     user_data = Userdata({
         'd1': self._group,
         'd2': 0x00,
         'd3': 0x00,
         'd4': 0x13,
         'd5': 0x00,
         'd6': 0x00
     })
     self._set_sent_property(DIMMABLE_KEYPAD_SCENE_ON_LEVEL, 0x00)
     cmd = ExtendedSend(self._address,
                        COMMAND_EXTENDED_TRIGGER_ALL_LINK_0X30_0X00,
                        user_data)
     cmd.set_checksum()
     self._send_method(cmd, self._received_scene_triggered)
Esempio n. 11
0
 def scene_on(self):
     """Trigger group/scene to ON level."""
     user_data = Userdata({
         'd1': self._group,
         'd2': 0x00,
         'd3': 0x00,
         'd4': 0x11,
         'd5': 0xff,
         'd6': 0x00
     })
     self._set_sent_property(DIMMABLE_KEYPAD_SCENE_ON_LEVEL, 0xff)
     cmd = ExtendedSend(self._address,
                        COMMAND_EXTENDED_TRIGGER_ALL_LINK_0X30_0X00,
                        user_data)
     cmd.set_checksum()
     _LOGGER.debug('Calling scene_on and sending response to '
                   '_received_scene_triggered')
     self._send_method(cmd, self._received_scene_triggered)
Esempio n. 12
0
 def scene_on(self):
     """Trigger group/scene to ON level."""
     user_data = Userdata({
         "d1": self._group,
         "d2": 0x00,
         "d3": 0x00,
         "d4": 0x11,
         "d5": 0xFF,
         "d6": 0x00,
     })
     self._set_sent_property(DIMMABLE_KEYPAD_SCENE_ON_LEVEL, 0xFF)
     cmd = ExtendedSend(self._address,
                        COMMAND_EXTENDED_TRIGGER_ALL_LINK_0X30_0X00,
                        user_data)
     cmd.set_checksum()
     _LOGGER.debug("Calling scene_on and sending response to "
                   "_received_scene_triggered")
     self._send_method(cmd, self._received_scene_triggered)
Esempio n. 13
0
 def scene_level(self, level):
     """Trigger group/scene to input level."""
     if level == 0:
         self.scene_off()
     else:
         user_data = Userdata({
             "d1": self._group,
             "d2": 0x00,
             "d3": 0x00,
             "d4": 0x11,
             "d5": level,
             "d6": 0x00,
         })
         self._set_sent_property(DIMMABLE_KEYPAD_SCENE_ON_LEVEL, level)
         cmd = ExtendedSend(self._address,
                            COMMAND_EXTENDED_TRIGGER_ALL_LINK_0X30_0X00,
                            user_data)
         cmd.set_checksum()
         self._send_method(cmd, self._received_scene_triggered)
Esempio n. 14
0
 def off(self):
     """Send an OFF message to device group."""
     off_command = ExtendedSend(self._address, COMMAND_LIGHT_OFF_0X13_0X00,
                                self._udata)
     off_command.set_checksum()
     self._send_method(off_command, self._off_message_received)