preheat_open.unit.Device

class preheat_open.unit.Device(type='', id=None, serial='', name='', components=None, location=None)

Bases: object

A device is a grouping of signals originating from a single physical data source (device), which is not linked to the building model.

Variables:
  • type (str) – The type of the device.

  • id (int | None) – The ID of the device.

  • name (str) – The name of the device.

  • components (list[Component]) – A list of components associated with the device.

  • adapter (Adapter) – The adapter for the device.

  • location (Location) – The location of the device.

  • _component_query_type (type) – The query type for components.

__init__(type='', id=None, serial='', name='', components=None, location=None)

Methods

__init__([type, id, serial, name, ...])

get_components([query, include_self])

Retrieves components associated with the device based on the specified query.

get_measurements(**kwargs)

Retrieves measurements for the device.

Attributes

timezone

Returns the timezone of the device.

get_components(query=None, include_self=False, **kwargs)

Retrieves components associated with the device based on the specified query.

Parameters:
  • query (Query | list[Query | dict] | None) – The query or list of queries to filter components.

  • include_self (bool) – Whether to include the device itself in the results if it matches the query.

  • kwargs – Additional keyword arguments for the query.

Returns:

A generator yielding components that match the query.

Return type:

Generator[Component, None, None]

get_measurements(**kwargs)

Retrieves measurements for the device.

Parameters:
  • start (datetime) – The start datetime for the measurements.

  • end (datetime) – The end datetime for the measurements.

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

  • resolution (TimeResolution) – The time resolution for the measurements.

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

Returns:

A DataFrame containing the measurements.

Return type:

pd.DataFrame

property timezone: tzinfo

Returns the timezone of the device.

Returns:

The timezone of the device.

Return type:

tzinfo