Beispiel #1
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)))
Beispiel #2
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')
Beispiel #3
0
 def test_03_62(self):
     """
     """
     l_cmd = insteon_utils.create_command_message('insteon_send')
     # print('A2-03-A - ', FormatBytes(l_cmd))
     self.assertEqual(len(l_cmd), 8)
     self.assertEqual(l_cmd[0], 0x02)
     self.assertEqual(l_cmd[1], 0x62)
Beispiel #4
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')
Beispiel #5
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')
Beispiel #6
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')
Beispiel #7
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')
Beispiel #8
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')
Beispiel #9
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')
Beispiel #10
0
 def test_01_Create(self):
     """
     """
     result = insteon_utils.create_command_message('insteon_send')
     # print(PrettyFormatAny.form(self.m_pyhouse_obj.House, 'A2-01-A - PyHouse'))
     self.assertEqual(len(result), 8)
Beispiel #11
0
 def test_02_61(self):
     l_cmd = insteon_utils.create_command_message('all_link_send')
     # print('A2-02-A - ', FormatBytes(l_cmd))
     self.assertEqual(len(l_cmd), 5)
     self.assertEqual(l_cmd[0], 0x02)
     self.assertEqual(l_cmd[1], 0x61)
Beispiel #12
0
 def test_01_60(self):
     l_cmd = insteon_utils.create_command_message('plm_info')
     # print('A2-01-A - ', FormatBytes(l_cmd))
     self.assertEqual(len(l_cmd), 2)
     self.assertEqual(l_cmd[0], 0x02)
     self.assertEqual(l_cmd[1], 0x60)