preheat_open.collection.Collection

class preheat_open.collection.Collection(locations=<factory>, adapter=None, _models_loaded=False)

Bases: object

Represents a collection of locations.

Variables:

locations – The locations in the collection.

__init__(locations=<factory>, adapter=None, _models_loaded=False)

Methods

__init__([locations, adapter, _models_loaded])

filter(location_info_filter)

Filters the collection based on a filter function.

from_location_ids(location_ids, adapter, ...)

Creates a collection from a list of locations.

from_location_information_list(...)

Creates a collection from a list of location information.

get_components([query])

Retrieves components associated with the location.

get_devices([query])

Retrieves devices associated with the location.

get_keys(**kwargs)

rtype:

Generator[None, None, LocationInformation]

get_measurements(**kwargs)

Retrieves measurements for the location.

get_units([query])

Retrieves units associated with the location.

get_zones([query])

Retrieves zones associated with the location.

load_building_models()

Loads the building models for each location in the collection.

Attributes

adapter

timezone

The timezone of the location.

locations

filter(location_info_filter)

Filters the collection based on a filter function.

Parameters:

filter_func – The filter function.

Return type:

Collection

Returns:

The filtered collection.

classmethod from_location_ids(location_ids, adapter, **kwargs)

Creates a collection from a list of locations.

Parameters:

location_list – The list of locations.

Return type:

Collection

Returns:

The collection.

classmethod from_location_information_list(location_information_list, **kwargs)

Creates a collection from a list of location information.

Parameters:

location_information_list (list[LocationInformation]) – The list of location information.

Return type:

Collection

Returns:

The collection.

get_components(query=None, **kwargs)

Retrieves components associated with the location.

Parameters:
  • query (Query | list[Query], optional) – The query to filter components.

  • kwargs – Additional arguments.

Returns:

A generator yielding components.

Return type:

Generator[Component, None, None]

get_devices(query=None, **kwargs)

Retrieves devices associated with the location.

Parameters:
  • query (Query, optional) – The query to filter devices.

  • kwargs – Additional arguments.

Returns:

A generator yielding devices.

Return type:

Generator[Device, None, None]

get_measurements(**kwargs)

Retrieves measurements for the location.

Parameters:
  • components (list[Component] | Query | dict) – The components to get measurements for.

  • date_range (DateRange, optional) – The date range for the measurements.

  • mapper (MapApplier, optional) – The mapper to apply to the measurements.

  • kwargs – Additional arguments.

Returns:

A DataFrame containing the measurements.

Return type:

pd.DataFrame

get_units(query=None, **kwargs)

Retrieves units associated with the location.

Parameters:
  • query (Query, optional) – The query to filter units.

  • kwargs – Additional arguments.

Returns:

A generator yielding units.

Return type:

Generator[Unit, None, None]

get_zones(query=None, **kwargs)

Retrieves zones associated with the location.

Parameters:
  • query (Query, optional) – The query to filter zones.

  • kwargs – Additional arguments.

Returns:

A generator yielding zones.

Return type:

Generator[Zone, None, None]

load_building_models()

Loads the building models for each location in the collection.

Return type:

None

property timezone: tzinfo

The timezone of the location.

Returns:

The timezone.

Return type:

str