示例#1
0
 def delete_link(self, p_controller_obj, p_address, p_group, p_flag):
     """Delete an all link record.
     """
     #  p_light_obj = LightData()
     p_light_obj = InsteonData()
     p_light_obj.InsteonAddress = conversions.dotted_hex2int(p_address)
     p_light_obj.GroupNumber = p_group
     #  p_code = 0x00  # Find First
     p_code = 0x00  #  Delete First Found record
     #  p_flag = 0xE2
     p_data = bytearray(b'\x00\x00\x00')
     LOG.info("Delete All-link record - Address:{}, Group:{:#02X}".format(p_light_obj.InsteonAddress, p_group))
     l_ret = Send.queue_0x6F_command(p_controller_obj, p_light_obj, p_code, p_flag, p_data)
     return l_ret
示例#2
0
 def delete_link(self, p_controller_obj, p_address, p_group, p_flag):
     """Delete an all link record.
     """
     #  p_light_obj = LightData()
     p_light_obj = InsteonData()
     p_light_obj.InsteonAddress = conversions.dotted_hex2int(p_address)
     p_light_obj.GroupNumber = p_group
     #  p_code = 0x00  # Find First
     p_code = 0x00  #  Delete First Found record
     #  p_flag = 0xE2
     p_data = bytearray(b'\x00\x00\x00')
     LOG.info(
         "Delete All-link record - Address:{0:}, Group:{1:#02X}".format(
             p_light_obj.InsteonAddress, p_group))
     l_ret = Commands.queue_6F_command(p_controller_obj, p_light_obj,
                                       p_code, p_flag, p_data)
     return l_ret
示例#3
0
 def _read_insteon(p_in_xml):
     l_insteon_obj = InsteonData()
     try:
         l_insteon_obj.InsteonAddress = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'InsteonAddress', '99.88.77'))
     except AttributeError:
         l_insteon_obj.InsteonAddress = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'Address', '99.88.77'))
     try:
         l_insteon_obj.DevCat = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'DevCat', 'A1.B2'))
         l_insteon_obj.GroupList = PutGetXML.get_text_from_xml(p_in_xml, 'GroupList')
         l_insteon_obj.GroupNumber = PutGetXML.get_int_from_xml(p_in_xml, 'GroupNumber', 0)
         l_insteon_obj.ProductKey = Xml._read_product_key(p_in_xml)
         l_insteon_obj.Version = PutGetXML.get_int_from_xml(p_in_xml, 'Version', 1)
     except Exception as e_err:
         LOG.error('ERROR: {}'.format(e_err))
     return l_insteon_obj
示例#4
0
    def get_obj_from_message(p_pyhouse_obj, p_message_addr):
        """ Here we have a message from the PLM.  Find out what device has that address.

        @param p_message_addr: is the address portion of the message byte array from the PLM we are extracting the Insteon address from.
        @param p_index: is the index of the first byte in the message.
                Various messages contain the address at different offsets.
        @return: The object that contains the address -or- a dummy object with noname in Name
        """
        l_address = Util.message2int(p_message_addr)  #  Extract the 3 byte address from the message and convert to an Int.
        if l_address < (256 * 256):  #  First byte zero ?
            l_dotted = str(l_address)
            l_device_obj = DeviceData()
            device_tools.stuff_new_attrs(l_device_obj, InsteonData())  #  an empty new object
            l_device_obj.Name = '**Group: ' + l_dotted + ' **'
        else:
            l_device_obj = Decode.find_address_all_classes(p_pyhouse_obj, l_address)
        return l_device_obj
示例#5
0
 def find_address_all_classes(p_pyhouse_obj, p_address):
     """ This will search thru all object groups that an inseton device could be in.
     @return: the object that has the address or a dummy object if not found
     """
     l_ret = Decode._find_addr_one_class(p_pyhouse_obj, p_pyhouse_obj.House.Lighting.Lights, p_address)
     l_dotted = conversions.int2dotted_hex(p_address, 3)
     if l_ret == None:
         l_ret = Decode._find_addr_one_class(p_pyhouse_obj, p_pyhouse_obj.House.Lighting.Controllers, p_address)
     if l_ret == None:
         l_ret = Decode._find_addr_one_class(p_pyhouse_obj, p_pyhouse_obj.House.Lighting.Buttons, p_address)
     if l_ret == None:
         l_ret = Decode._find_addr_one_class(p_pyhouse_obj, p_pyhouse_obj.House.Hvac.Thermostats, p_address)
     #  Add additional classes in here
     if l_ret == None:
         LOG.info("WARNING - Address {} ({}) *NOT* found.".format(l_dotted, p_address))
         l_ret = DeviceData()
         device_tools.stuff_new_attrs(l_ret, InsteonData())  #  an empty new object
         l_ret.Name = '**NoName-' + l_dotted + '-**'
     return l_ret
示例#6
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_api = Insteon_device.API(self.m_pyhouse_obj)
     self.m_device = InsteonData()