preheat_open.unit.Unit
- class preheat_open.unit.Unit(type=None, subtype=None, descriptors=None, zones=None, shared=False, shared_from=None, shared_locations=None, parent=None, children=None, related_units=None, covers_building=None, buildings_covered=None, control_settings=None, setpoint_schedule=None, electricity_prices=None, **kwargs)
Bases:
DeviceDefines a unit in the PreHEAT sense.
- Variables:
type (Enum | None) – The type of the unit.
subtype (Enum | None) – The subtype of the unit.
descriptors (UnitDescriptors) – The descriptors of the unit.
zones (list[Zone]) – A list of zones associated with the unit.
shared (bool) – Indicates if the unit is shared.
shared_from (int | None) – The ID of the unit from which this unit is shared.
shared_locations (list[int]) – A list of IDs of locations where the unit is shared.
parent (Unit | None) – The parent unit.
children (list[Unit]) – A list of child units.
related_units (list[Unit]) – A list of related units.
covers_building (bool) – Indicates if the unit covers a building.
buildings_covered (int) – The number of buildings covered by the unit.
control_settings (ControlSettings | None) – The control settings of the unit.
- __init__(type=None, subtype=None, descriptors=None, zones=None, shared=False, shared_from=None, shared_locations=None, parent=None, children=None, related_units=None, covers_building=None, buildings_covered=None, control_settings=None, setpoint_schedule=None, electricity_prices=None, **kwargs)
Methods
__init__([type, subtype, descriptors, ...])from_building_model_dict(data, adapter)Creates a Unit object from a building model dictionary.
get_components([query, include_self])Retrieves components associated with the device based on the specified query.
get_electricity_price(date_range[, ...])Retrieves electricity prices for the unit.
get_measurements(**kwargs)Retrieves measurements for the device.
get_parents([query, include_self])Retrieves parent units associated with the unit based on the specified query.
get_schedule(date_range)Loads the past schedule for the unit and a given period.
get_sub_units([query, include_self])Retrieves sub-units associated with the unit based on the specified query.
request_schedule(schedule)Sends a scheduling request to the API.
Converts the Unit object to a dictionary.
Attributes
Returns the timezone of the device.
- classmethod from_building_model_dict(data, adapter)
Creates a Unit object from a building model dictionary.
- Return type:
- get_components(query=None, include_self=False, **kwargs)
Retrieves components associated with the device based on the specified query.
- Parameters:
- Returns:
A generator yielding components that match the query.
- Return type:
Generator[Component, None, None]
- get_electricity_price(date_range, include_tariff=True, include_vat=True)
Retrieves electricity prices for the unit.
- Parameters:
date_range (DateRange) – The date range for the electricity prices.
- Returns:
A DataFrame containing the electricity prices.
- Return type:
pd.DataFrame
- 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
- get_parents(query=None, include_self=False, **kwargs)
Retrieves parent units associated with the unit based on the specified query.
- Parameters:
- Returns:
A generator yielding parent units that match the query.
- Return type:
Generator[Unit, None, None]
- get_schedule(date_range)
Loads the past schedule for the unit and a given period.
- Parameters:
date_range (DateRange) – The date range for the schedule.
- Returns:
The setpoint schedule for the specified date range.
- Return type:
- get_sub_units(query=None, include_self=False, **kwargs)
Retrieves sub-units associated with the unit based on the specified query.
- Parameters:
- Returns:
A generator yielding sub-units that match the query.
- Return type:
Generator[Unit, None, None]
- request_schedule(schedule)
Sends a scheduling request to the API.
- Parameters:
schedule (SetpointSchedule) – The schedule to execute.
- Returns:
The response for the scheduling request.
- Return type:
requests.Response
- property timezone: tzinfo
Returns the timezone of the device.
- Returns:
The timezone of the device.
- Return type:
tzinfo
- to_building_model_dict()
Converts the Unit object to a dictionary.
- Returns:
A dictionary representation of the unit.
- Return type:
dict