コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 def test_01_CreateJson(self):
     """ Create a JSON object for Location.
     """
     l_obj = lightsAPI.read_all_lights_xml(self.m_pyhouse_obj,
                                           self.m_xml.light_sect)
     print(PrettyFormatAny.form(l_obj, 'Lights'))
     l_json = json_tools.encode_json(l_obj)
     print(PrettyFormatAny.form(l_json, 'JSON'))
コード例 #4
0
 def _read_lights(self, p_pyhouse_obj, p_xml):
     try:
         l_xml = p_xml.find('LightSection')
         l_ret = lightsAPI.read_all_lights_xml(p_pyhouse_obj, l_xml)
     except AttributeError as e_err:
         l_ret = {}
         l_msg = 'No Lights found: {}'.format(e_err)
         LOG.warning(l_msg)
     return l_ret
コード例 #5
0
 def _read_lights(self, p_pyhouse_obj, p_xml, p_version):
     try:
         l_xml = p_xml.find("LightSection")
         l_ret = lightsAPI.read_all_lights_xml(p_pyhouse_obj, l_xml, p_version)
     except AttributeError as e_err:
         l_ret = {}
         l_msg = "No Lights found: {}".format(e_err)
         LOG.warning(l_msg)
     return l_ret
コード例 #6
0
 def setUp(self, p_root):
     self.m_pyhouse_obj = SetupPyHouseObj().BuildPyHouseObj(p_root)
     self.m_version = '1.4.0'
     self.m_xml = SetupPyHouseObj().BuildXml(p_root)
     self.m_pyhouse_obj.House.FamilyData = familyAPI(
         self.m_pyhouse_obj).LoadFamilyTesting()
     self.m_pyhouse_obj.House.Lighting.Controllers = controllerAPI(
     ).read_all_controllers_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.House.Lighting.Lights = lightsAPI.read_all_lights_xml(
         self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version)
     self.m_pyhouse_obj.House.Hvac = hvacXML.read_hvac_xml(
         self.m_pyhouse_obj)
コード例 #7
0
 def setUp(self, p_root):
     self.m_pyhouse_obj = SetupPyHouseObj().BuildPyHouseObj(p_root)
     self.m_version = '1.4.0'
     self.m_xml = SetupPyHouseObj().BuildXml(p_root)
     self.m_pyhouse_obj.House.FamilyData = familyAPI(
                         self.m_pyhouse_obj).LoadFamilyTesting()
     self.m_pyhouse_obj.House.Lighting.Controllers = controllerAPI().read_all_controllers_xml(
                         self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version)
     self.m_pyhouse_obj.House.Lighting.Lights = lightsAPI.read_all_lights_xml(
                         self.m_pyhouse_obj, self.m_xml.controller_sect, self.m_version)
     self.m_pyhouse_obj.House.Hvac = hvacXML.read_hvac_xml(
                         self.m_pyhouse_obj)
コード例 #8
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
コード例 #9
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
コード例 #10
0
 def test_05_AllLights(self):
     """Read everything for all lights.
     """
     l_objs = lightsAPI.read_all_lights_xml(self.m_pyhouse_obj,
                                            self.m_xml.light_sect)
     self.assertEqual(len(l_objs), 2)
コード例 #11
0
 def test_01_CreateJson(self):
     """ Create a JSON object for Location.
     """
     l_obj = lightsAPI.read_all_lights_xml(self.m_pyhouse_obj, self.m_xml.light_sect, self.m_version)
     #  print('Light: {0:}'.format(l_obj))
     l_json = json_tools.encode_json(l_obj)
コード例 #12
0
 def test_05_AllLights(self):
     """Read everything for all lights.
     """
     l_objs = lightsAPI.read_all_lights_xml(self.m_pyhouse_obj, self.m_xml.light_sect, self.m_version)
     self.assertEqual(len(l_objs), 2)