Пример #1
0
 def queue_0x6F_command(self, p_controller_obj, p_light_obj, p_code, p_flag,
                        p_data):
     """Manage All-Link Record (11 bytes)
      See p 252(265) of 2009 developers guide.
     [0] = 0x02
     [1] = 0x6F
     [2] = Control Code
     [3] = All-Link record flag
     [4] = All-Link ecord group
     [5-7] = 3 Byte Link to address
     [8] = Data
     [9] = Data
     [10] = Data
    """
     LOG.info("Command to manage all-link record (6F).")
     l_command = insteon_utils.create_command_message(
         'manage_all_link_record')
     l_command[2] = p_code
     l_command[3] = p_flag
     l_command[4] = p_light_obj.GroupNumber
     insteon_utils.insert_address_into_message(p_light_obj.Family.Address,
                                               l_command, 5)
     l_command[8:11] = p_data
     insteon_utils.queue_command(p_controller_obj, l_command,
                                 'Manage ALDB record')
Пример #2
0
    def _queue_62_command(p_controller_obj,
                          p_obj,
                          p_cmd1,
                          p_cmd2,
                          p_text='None'):
        """Send Insteon Standard Length Message (8 bytes) (SD command).
        or Extended length (22 Bytes) (ED command)
        See page 230(243) of 2009 developers guide.

        @param p_obj: is the device object.
        @param p_cmd1: is the first command byte
        @param p_cmd2: is the second command byte

        [0] = x02
        [1] = 0x62
        [2-4] = to address
        [5] = Message Flags
        [6] = Command 1
        [7] = Command 2
        (8-21) = Extended data in ED type
        """
        try:
            l_command = insteon_utils.create_command_message('insteon_send')
            insteon_utils.insert_address_into_message(p_obj.Family.Address,
                                                      l_command, 2)
            l_command[5] = FLAG_MAX_HOPS + FLAG_HOPS_LEFT  #  0x0F
            l_command[6] = p_obj._Command1 = p_cmd1
            l_command[7] = p_obj._Command2 = p_cmd2
            insteon_utils.queue_command(p_controller_obj, l_command, p_text)
            # LOG.debug('Send Command: {}'.format(FormatBytes(l_command)))
        except Exception as _e_err:
            LOG.error('Error creating command: {}\n{}\n>>{}<<'.format(
                _e_err, PrettyFormatAny.form(p_obj, 'Device'),
                FormatBytes(l_command)))
Пример #3
0
 def _queue_60_command(p_controller_obj):
     """Get IM info (2 bytes).
     See p 273 of developers guide.
     PLM will respond with a 0x60 response.
     """
     LOG.info("Command to get IM info (60)")
     l_command = insteon_utils.create_command_message('plm_info')
     insteon_utils.queue_command(p_controller_obj, l_command, 'Plm Info')
Пример #4
0
 def queue_73_command(p_controller_obj):
     """Send request for PLM configuration (2 bytes).
     See page 270 of Insteon Developers Guide.
     """
     LOG.info("Command to get PLM config (73).")
     l_command = insteon_utils.create_command_message('plm_get_config')
     insteon_utils.queue_command(p_controller_obj, l_command,
                                 'Get Plm Config')
Пример #5
0
 def queue_0x6A_command(self, p_controller_obj):
     """Get the next all-link record from the plm (2 bytes).
     See p 249(262) of 2009 developers guide.
     """
     LOG.info("Command to get the next all-link record (0x6A).")
     l_command = insteon_utils.create_command_message('plm_next_all_link')
     insteon_utils.queue_command(p_controller_obj, l_command,
                                 'Next All-Link')
Пример #6
0
 def queue_0x69_command(self, p_controller_obj):
     """Get the first all-link record from the plm (2 bytes).
     See p 248(261) of 2009 developers guide.
     """
     LOG.info("Command to get First all-link record (0x69).")
     l_command = insteon_utils.create_command_message('plm_first_all_link')
     insteon_utils.queue_command(p_controller_obj, l_command,
                                 'First All-Link')
Пример #7
0
 def queue_0x67_command(self, p_controller_obj):
     """Reset the PLM (2 bytes)
     Puts the IM into the factory reset state which clears the All-Link Database.
     See p 255(268) of 2009 developers guide.
     """
     LOG.info("Queue command to reset the PLM (67).")
     l_command = insteon_utils.create_command_message('plm_reset')
     insteon_utils.queue_command(p_controller_obj, l_command, 'Reset PLM')
Пример #8
0
 def queue_6B_command(p_controller_obj, p_flags):
     """Set IM configuration flags (3 bytes).
     See page 271  of Insteon Developers Guide.
     """
     LOG.info(
         "Command to set PLM config flag (6B) - to {:#X}".format(p_flags))
     l_command = insteon_utils.create_command_message('plm_set_config')
     l_command[2] = p_flags
     insteon_utils.queue_command(p_controller_obj, l_command,
                                 'Set Plm Config')
Пример #9
0
 def read_aldb_v2(self, p_controller_obj):
     """
     """
     # LOG.debug(PrettyFormatAny.form(p_controller_obj, 'Controller'))
     l_command = bytearray(22)
     l_command[0] = 0x02
     l_command[1] = 0x62
     insteon_utils.insert_address_into_message(
         p_controller_obj.Family.Address, l_command, 2)
     l_command[5] = 0x13
     l_command[6] = 0x2f  #  Cmd1
     l_command[7] = 0x00  #  Cmd2
     l_command[8] = 0x00  #  D1  Unused
     l_command[9] = 0x00  #  D2  Record request
     l_command[10] = 0x00  # D3  High Byte
     l_command[11] = 0x00  # D4  Low Byte
     l_command[12] = 0x00  # D5  All Records
     insteon_utils.queue_command(p_controller_obj, l_command, 'Query ALDB')