def test_05_AllLights(self): l_objs = lightsAPI.read_all_lights_xml(self.m_pyhouse_obj, self.m_xml.light_sect, self.m_version) self.m_pyhouse_obj.House.Lighting.Lights = l_objs # print(PrettyFormatAny.form(l_objs, 'Lights')) l_xml = lightsAPI.write_all_lights_xml(self.m_pyhouse_obj) print(PrettyFormatAny.form(l_xml, 'Lights XML')) l_xml0 = l_xml.find('Light') self.assertEqual(l_xml0.find('UUID').text, TESTING_DEVICE_UUID) self.assertEqual(l_xml0.find('Comment').text, TESTING_DEVICE_COMMENT)
def test_05_AllLights(self): l_objs = lightsAPI.read_all_lights_xml(self.m_pyhouse_obj, self.m_xml.light_sect) self.m_pyhouse_obj.House.Lighting = LightingData() self.m_pyhouse_obj.House.Lighting.Lights = l_objs print(PrettyFormatAny.form(self.m_pyhouse_obj.House, 'PyHouse')) self.m_pyhouse_obj.House.Lighting.Lights = l_objs print(PrettyFormatAny.form(l_objs, 'Lights')) l_xml = lightsAPI.write_all_lights_xml(self.m_pyhouse_obj) print(PrettyFormatAny.form(l_xml, 'Lights XML')) l_xml0 = l_xml.find('Light') self.assertEqual(l_xml0.find('UUID').text, TESTING_LIGHT_UUID_0) self.assertEqual(l_xml0.find('Comment').text, TESTING_LIGHT_COMMENT_0)
def _write_lighting_xml(p_pyhouse_obj, p_house_element): """ @param p_pyhouse_obj: is the whole PyHouse Object @param p_house_element: is the XML """ l_lighting_xml = ET.Element("LightingSection") try: l_xml = lightsAPI.write_all_lights_xml(p_pyhouse_obj) l_lighting_xml.append(l_xml) l_lighting_xml.append(buttonsAPI.write_buttons_xml(p_pyhouse_obj)) l_lighting_xml.append(controllersAPI.write_all_controllers_xml(p_pyhouse_obj)) except AttributeError as e_err: l_msg = "ERROR-109: {}".format(e_err) LOG.error(l_msg) p_house_element.append(l_lighting_xml) return l_lighting_xml
def _write_lighting_xml(p_pyhouse_obj, p_house_element): """ @param p_pyhouse_obj: is the whole PyHouse Object @param p_house_element: is the XML """ l_lighting_xml = ET.Element('LightingSection') try: l_xml = lightsAPI.write_all_lights_xml(p_pyhouse_obj) l_lighting_xml.append(l_xml) l_lighting_xml.append(buttonsAPI.write_buttons_xml(p_pyhouse_obj)) l_lighting_xml.append( controllersAPI.write_all_controllers_xml(p_pyhouse_obj)) except AttributeError as e_err: l_msg = 'ERROR-109: {}'.format(e_err) LOG.error(l_msg) p_house_element.append(l_lighting_xml) return l_lighting_xml