def read_base_device_object_xml(p_pyhouse_obj, p_obj, p_xml): """ Get the BaseObject entries from the XML element. @param p_obj: is the object we wish to populate with data @param p_xml: is the element we will extract data from (including children). """ try: p_obj.Name = PutGetXML.get_text_from_xml(p_xml, 'Name', 'Missing Name') p_obj.Key = PutGetXML.get_int_from_xml(p_xml, 'Key', 0) p_obj.Active = PutGetXML.get_bool_from_xml(p_xml, 'Active', False) p_obj.UUID = PutGetXML.get_uuid_from_xml(p_xml, 'UUID') p_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment') p_obj.DeviceFamily = PutGetXML.get_text_from_xml( p_xml, 'DeviceFamily') p_obj.DeviceType = PutGetXML.get_int_from_xml(p_xml, 'DeviceType') p_obj.DeviceSubType = PutGetXML.get_int_from_xml( p_xml, 'DeviceSubType') p_obj.RoomCoords = PutGetXML.get_coords_from_xml( p_xml, 'RoomCoords') p_obj.RoomName = PutGetXML.get_text_from_xml(p_xml, 'RoomName') p_obj.RoomUUID = PutGetXML.get_text_from_xml(p_xml, 'RoomUUID') except Exception as e_err: LOG.error( 'ERROR in xml_tools.read_base_obj_xml() - {}'.format(e_err)) print('Error 111', e_err) return p_obj
def _read_one_lighting_schedule(p_schedule_element): """Extract schedule information from a schedule xml element. """ l_obj = ScheduleLightData() l_obj = Xml._read_one_base_schedule(p_schedule_element) l_obj.Level = PutGetXML.get_int_from_xml(p_schedule_element, 'Level') l_obj.LightName = PutGetXML.get_text_from_xml(p_schedule_element, 'LightName') l_obj.LightUUID = PutGetXML.get_uuid_from_xml(p_schedule_element, 'LightUUID') l_obj.Rate = PutGetXML.get_int_from_xml(p_schedule_element, 'Rate') l_obj.RoomName = PutGetXML.get_text_from_xml(p_schedule_element, 'RoomName') l_obj.RoomUUID = PutGetXML.get_uuid_from_xml(p_schedule_element, 'RoomUUID') return l_obj # for testing
def read_base_device_object_xml(p_obj, p_xml): """ Get the BaseObject entries from the XML element. @param p_obj: is the object we wish to populate with data @param p_xml: is the element we will extract data from (including children). """ try: p_obj.Name = PutGetXML.get_text_from_xml(p_xml, "Name", "Missing Name") p_obj.Key = PutGetXML.get_int_from_xml(p_xml, "Key", 0) p_obj.Active = PutGetXML.get_bool_from_xml(p_xml, "Active", False) p_obj.Comment = PutGetXML.get_text_from_xml(p_xml, "Comment") p_obj.DeviceFamily = PutGetXML.get_text_from_xml(p_xml, "DeviceFamily") p_obj.DeviceType = PutGetXML.get_int_from_xml(p_xml, "DeviceType") p_obj.DeviceSubType = PutGetXML.get_int_from_xml(p_xml, "DeviceSubType") p_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_xml, "RoomCoords") p_obj.RoomName = PutGetXML.get_text_from_xml(p_xml, "RoomName") p_obj.UUID = PutGetXML.get_uuid_from_xml(p_xml, "UUID") except Exception as e_err: LOG.warn("ERROR in xml_tools.read_base_obj_xml() - {}".format(e_err)) print(e_err) return p_obj