def test_06_OneController(self):
     """ Read in the xml file and fill in the lights
     """
     l_obj = Utility._read_one_controller_xml(self.m_pyhouse_obj, self.m_xml.controller)
     print(PrettyFormatAny.form(l_obj, 'B1-06-A - OneController', 100))
     self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0)
     self.assertEqual(l_obj.Active, (TESTING_CONTROLLER_ACTIVE_0 == 'True'))
     self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0)
     self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT)
     self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_obj.DeviceType, int(TESTING_DEVICE_TYPE))
     self.assertEqual(l_obj.DeviceSubType, int(TESTING_DEVICE_SUBTYPE))
     self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME)
     self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL)
     self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL)
     self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE))
     self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE))
     self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY)
     self.assertEqual(str(l_obj.RtsCts), TESTING_SERIAL_RTS_CTS)
     self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS))
     self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT))
     self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True')
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0)
     self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
Пример #2
0
 def test_06_OneController(self):
     """ Read in the xml file and fill in the lights
     """
     l_obj = Utility._read_one_controller_xml(self.m_pyhouse_obj, self.m_xml.controller, self.m_version)
     print(PrettyFormatAny.form(l_obj, 'OneController', 100))
     self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0)
     self.assertEqual(l_obj.Active, (TESTING_CONTROLLER_ACTIVE_0 == 'True'))
     self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0)
     self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT)
     self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_obj.DeviceType, int(TESTING_DEVICE_TYPE))
     self.assertEqual(l_obj.DeviceSubType, int(TESTING_DEVICE_SUBTYPE))
     self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME)
     self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL)
     self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL)
     self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE))
     self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE))
     self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY)
     self.assertEqual(l_obj.RtsCts, TESTING_SERIAL_RTS_CTS == 'True')
     self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS))
     self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT))
     self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True')
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0)
     self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
Пример #3
0
 def test_05_OneMotion(self):
     """ Read in the xml file and fill in the lights
     """
     l_dev = Utility._read_one_motion_xml(self.m_pyhouse_obj, self.m_xml.motiondetector)
     # print(PrettyFormatAny.form(l_dev, 'B1-05-A - Motion Detector'))
     self.assertEqual(str(l_dev.Name), TESTING_MOTION_SENSOR_NAME_0)
     self.assertEqual(str(l_dev.Active), TESTING_MOTION_SENSOR_ACTIVE_0)
     self.assertEqual(str(l_dev.Key), TESTING_MOTION_SENSOR_KEY_0)
     self.assertEqual(l_dev.DevCat, conversions.dotted_hex2int(TESTING_MOTION_SENSOR_DEVCAT_0))
     self.assertEqual(str(l_dev.EngineVersion), TESTING_INSTEON_ENGINE_VERSION_0)
     self.assertEqual(l_dev.InsteonAddress, conversions.dotted_hex2int(TESTING_MOTION_SENSOR_ADDRESS_0))
Пример #4
0
 def test_02_OneDoor(self):
     """ Read in the xml file and fill in the lights
     """
     l_door = Utility._read_one_door_xml(self.m_pyhouse_obj, self.m_xml.garagedoor)
     # print(PrettyFormatAny.form(l_door, 'B1-02-A - Button'))
     self.assertEqual(str(l_door.Name), TESTING_GARAGE_DOOR_NAME_0)
     self.assertEqual(str(l_door.Active), TESTING_GARAGE_DOOR_ACTIVE_0)
     self.assertEqual(str(l_door.Key), TESTING_GARAGE_DOOR_KEY_0)
     self.assertEqual(l_door.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(str(l_door.EngineVersion), TESTING_INSTEON_ENGINE_VERSION_0)
     self.assertEqual(l_door.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
 def test_04_Family(self):
     """Read controller family
     """
     l_xml = self.m_xml.controller
     l_obj = Utility._read_base_device(self.m_pyhouse_obj, l_xml)
     Utility._read_controller_data(self.m_pyhouse_obj, l_obj, l_xml)
     Utility._read_interface_data(self.m_pyhouse_obj, l_obj, l_xml)
     Utility._read_family_data(self.m_pyhouse_obj, l_obj, l_xml)
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(l_obj.ProductKey, conversions.dotted_hex2int(TESTING_INSTEON_PRODUCT_KEY_0))
     self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0)
     self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
Пример #6
0
 def test_04_Family(self):
     """Read controller family
     """
     l_obj = Utility._read_base_device(self.m_xml.controller, self.m_version)
     Utility._read_controller_data(l_obj, self.m_xml.controller, self.m_version)
     Utility._read_interface_data(l_obj, self.m_xml.controller, self.m_version)
     Utility._read_family_data(self.m_pyhouse_obj, l_obj, self.m_xml.controller, self.m_version)
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(l_obj.ProductKey, conversions.dotted_hex2int(TESTING_INSTEON_PRODUCT_KEY_0))
     self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0)
     self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
     self.assertEqual(l_obj.Version, int(TESTING_INSTEON_VERSION))
Пример #7
0
 def test_06_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_xml, self.m_version)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3), TESTING_INSTEON_PRODUCT_KEY_0)
Пример #8
0
 def test_05_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, l_device, l_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     # print(PrettyFormatAny.form(l_light, 'C4-05-A - Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3), TESTING_INSTEON_PRODUCT_KEY_0)
Пример #9
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
Пример #10
0
 def test_03_FamilyData(self):
     """Test the family data read.
     """
     l_obj = Utility._read_base_device(self.m_pyhouse_obj, self.m_xml.light)
     Utility._read_family_data(self.m_pyhouse_obj, l_obj, self.m_xml.light)
     self.assertEqual(l_obj.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #11
0
 def test_01_setup(self):
     # print(PrettyFormatAny.form(self.m_light, 'Light Device 2'))
     self.assertEqual(self.m_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(self.m_light.DeviceFamily,
                      TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(self.m_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #12
0
 def test_05_InsteonLight(self):
     l_light = self.m_api.read_base_device_object_xml(self.m_pyhouse_obj, self.m_device, self.m_xml.light)
     insteonXml.ReadXml(l_light, self.m_xml.light)
     # print(PrettyFormatAny.form(l_light, 'C1-05-A - Insteon Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #13
0
 def test_04_InsteonLight(self):
     l_light = self.m_core_api.read_core_lighting_xml(
         self.m_device, self.m_xml.light, self.m_version)
     insteonXml.ReadXml(l_light, self.m_xml.light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #14
0
 def test_05_FamilyData0(self):
     """ Read the Insteon family data info.
     """
     l_xml = self.m_xml.light_sect[0]
     l_obj = Utility._read_base_device(self.m_pyhouse_obj, l_xml)
     Utility._read_family_data(self.m_pyhouse_obj, l_obj, self.m_xml.light)
     # print(PrettyFormatAny.form(l_obj, 'B1-05-A - Base'))
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #15
0
 def _read_product_key(p_entry_xml, p_default = '98.76.54'):
     l_ret = p_default
     try:
         l_prod = PutGetXML.get_text_from_xml(p_entry_xml, 'ProductKey', p_default)
         l_ret = conversions.dotted_hex2int(l_prod)
     except Exception:
         l_ret.ProductKey = p_default
     return l_ret
Пример #16
0
 def test_03_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     # print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #17
0
 def test_05_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, l_device, l_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat,
                      conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3),
                      TESTING_INSTEON_PRODUCT_KEY_0)
Пример #18
0
 def test_03_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #19
0
 def test_01_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light_sect[0]
     print(PrettyFormatAny.form(l_xml, 'C3-01-A - XML'))
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'C3-01-B - Light'))
     self.assertEqual(l_device.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #20
0
 def test_02_ReadOneButtonXml(self):
     """ Read in the xml file and fill in the lights
     """
     l_button = Utility._read_one_button_xml(self.m_pyhouse_obj, self.m_xml.button)
     self.assertEqual(l_button.Name, TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_button.Active, True)
     self.assertEqual(l_button.Key, 0, 'Bad key')
     self.assertEqual(l_button.Name, TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_button.DeviceFamily, TESTING_LIGHTING_BUTTON_FAMILY_0)
     self.assertEqual(l_button.InsteonAddress, conversions.dotted_hex2int(TESTING_LIGHTING_BUTTON_INSTEON_ADDRESS_0))
Пример #21
0
 def test_02_Light(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light_sect[1]
     print(PrettyFormatAny.form(l_xml, 'C3-02-A - XML'))
     l_device = self.m_device_obj
     l_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'C3-02-B - Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_1)
     self.assertEqual(l_device.RoomName, TESTING_LIGHT_ROOM_NAME_1)
     self.assertEqual(l_light.UPBAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #22
0
 def test_02_ReadOneButtonXml(self):
     """ Read in the xml file and fill in the lights
     """
     l_button = Utility._read_one_button_xml(self.m_pyhouse_obj, self.m_xml.button, self.m_version)
     self.assertEqual(l_button.Name, TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_button.Active, True)
     self.assertEqual(l_button.Key, 0, 'Bad key')
     self.assertEqual(l_button.Name, TESTING_LIGHTING_BUTTON_NAME_0)
     self.assertEqual(l_button.DeviceFamily, 'Insteon', 'Bad Lighting family')
     self.assertEqual(l_button.LightingType, 'Button', 'Bad LightingType')
     self.assertEqual(l_button.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #23
0
 def test_01_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, l_device, l_in_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = deviceXML.write_base_device_object_xml('Light', l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #24
0
 def test_03_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_in_xml, self.m_version)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = LightingCoreAPI.write_core_lighting_xml("Light", l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #25
0
 def test_04_OneLight(self):
     """ Read everything about one light.
     """
     l_obj = Utility._read_one_light_xml(self.m_pyhouse_obj,
                                         self.m_xml.light)
     self.assertEqual(l_obj.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(str(l_obj.Key), TESTING_LIGHT_KEY_0)
     self.assertEqual(str(l_obj.Active), TESTING_LIGHT_ACTIVE_0)
     self.assertEqual(l_obj.Comment, TESTING_LIGHT_COMMENT_0)
     self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_obj.RoomName, TESTING_LIGHT_ROOM_NAME_0)
     self.assertEqual(l_obj.LightingType, TESTING_LIGHT_TYPE_0)
     self.assertEqual(l_obj.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #26
0
 def test_02_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, l_device, l_in_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = LightingCoreAPI.write_core_lighting_xml('Light', l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #27
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
Пример #28
0
 def test_04_OneLight(self):
     """ Read everything about one light.
     """
     l_obj = Utility._read_one_light_xml(self.m_pyhouse_obj, self.m_xml.light, self.m_version)
     self.assertEqual(l_obj.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_obj.Name, 'Insteon Light')
     self.assertEqual(l_obj.Key, 0)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT)
     self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME)
     self.assertEqual(l_obj.LightingType, 'Light')
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_obj.RoomCoords.X_Easting, float(TESTING_DEVICE_ROOM_X))
Пример #29
0
 def test_07_OneLight0(self):
     """ Read everything about one light.
     """
     l_xml = self.m_xml.light_sect[0]
     l_obj = Utility._read_one_light_xml(self.m_pyhouse_obj, l_xml)
     # print(PrettyFormatAny.form(l_obj, 'B1-07-A - One Light'))
     # print(PrettyFormatAny.form(l_obj.RoomCoords, 'B1-4-B - One Light'))
     self.assertEqual(l_obj.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(str(l_obj.Key), TESTING_LIGHT_KEY_0)
     self.assertEqual(str(l_obj.Active), TESTING_LIGHT_ACTIVE_0)
     self.assertEqual(l_obj.UUID, TESTING_LIGHT_UUID_0)
     self.assertEqual(l_obj.Comment, TESTING_LIGHT_COMMENT_0)
     self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_obj.RoomName, TESTING_LIGHT_ROOM_NAME_0)
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #30
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
Пример #31
0
 def test_03_FamilyData(self):
     """Test the family data read.
     """
     l_obj = Utility._read_base_device(self.m_xml.light, self.m_version)
     Utility._read_family_data(self.m_pyhouse_obj, l_obj, self.m_xml.light, self.m_version)
     self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #32
0
 def test_02_A1(self):
     l_hex = 'A1:B2:C3'
     l_int = conversions.dotted_hex2int(l_hex)
     print('C1-02-A - ', l_hex, l_int)
     self.assertEqual(l_int, 10597059)
Пример #33
0
 def test_04_InsteonLight(self):
     l_light = self.m_core_api.read_core_lighting_xml(self.m_device, self.m_xml.light, self.m_version)
     insteonXml.ReadXml(l_light, self.m_xml.light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Пример #34
0
 def test_01_setup(self):
     # print(PrettyFormatAny.form(self.m_light, 'C2-01-A - Light Device 2'))
     self.assertEqual(self.m_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(self.m_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(self.m_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))