def test_04_Add(self): l_obj_0 = UuidData() l_obj_0.UUID = '12345678-dead-beef-dead-fedcba987654' l_obj_0.UuidType = 'House' Uuid.add_uuid(self.m_pyhouse_obj, l_obj_0) print(PrettyFormatAny.form(self.m_pyhouse_obj.Uuids, 'B1-4-A one')) self.assertEqual(self.m_pyhouse_obj.Uuids[l_obj_0.UUID].UuidType, l_obj_0.UuidType) # l_obj_1 = UuidData() l_obj_1.UUID = '01234567-dead-beef-dead-fedcba987654' l_obj_1.UuidType = 'Room' Uuid.add_uuid(self.m_pyhouse_obj, l_obj_1) print(PrettyFormatAny.form(self.m_pyhouse_obj.Uuids, 'B1-4-B two')) self.assertEqual(self.m_pyhouse_obj.Uuids[l_obj_1.UUID].UuidType, l_obj_1.UuidType)
def _read_all_thermostats_xml(p_pyhouse_obj, p_xml): l_dict = {} l_count = 0 try: for l_xml in p_xml.iterfind('Thermostat'): l_obj = Utility._read_one_thermostat_xml(p_pyhouse_obj, l_xml) l_obj.Key = l_count l_dict[l_count] = l_obj p_pyhouse_obj.Uuids[l_obj.UUID] = UtilUuid.add_uuid( p_pyhouse_obj, 'Thermostat') l_count += 1 except AttributeError as e_err: LOG.error('Reading Hvac.Thermostat information - {}'.format(e_err)) LOG.info("Loaded {} Thermostats".format(l_count)) return l_dict
def read_all_lights_xml(p_pyhouse_obj, p_light_sect_xml): """ @param p_pyhouse_obj: is the master information store @param p_light_sect_xml: the "LightSection" of the config @param p_version: is the XML version of the file to use. @return: a dict of lights info """ l_count = 0 l_dict = {} try: for l_xml in p_light_sect_xml.iterfind('Light'): l_obj = Utility._read_one_light_xml(p_pyhouse_obj, l_xml) l_obj.Key = l_count # Renumber l_dict[l_count] = l_obj p_pyhouse_obj.Uuids[l_obj.UUID] = UtilUuid.add_uuid(p_pyhouse_obj, 'Light') l_count += 1 except AttributeError as e_err: # No Lights section LOG.warning('Lighting_Lights - No Lights defined - {}'.format(e_err)) # print('XXX-1', e_err) l_dict = {} LOG.info("Loaded {} Lights".format(l_count)) return l_dict