preheat_open.api.adapter.ApiAdapter
- class preheat_open.api.adapter.ApiAdapter(config=None, _api_session=None, _cache=None)
Bases:
Adapter- __init__(config=None, _api_session=None, _cache=None)
Methods
__init__([config, _api_session, _cache])close()Close connection to the building management system.
Retrieve a collection containing all available locations.
Retrieve information about all available locations.
get_comfort_profile_setpoints(date_range, ...)Retrieve comfort profile setpoints for a location and date range.
get_devices(location_id)Retrieve all devices for a specific location.
get_electricity_prices(date_range, unit[, ...])Retrieve electricity prices for a unit and date range.
get_features(location_id)Retrieve available features for a specific location.
get_location(location_id)Retrieve a specific location by ID.
get_locations(location_ids)Retrieve multiple locations by their IDs.
get_price_components(supply_point_ids)Retrieve price components for specified supply points.
get_price_data(date_range, price_component_ids)Retrieve price data for specified components and date range.
get_setpoint_schedule(date_range, control_unit)Retrieve setpoint schedule from a control unit.
load_measurements(components, date_range[, ...])Load measurement data for specified components and date range.
location_key(location_id)- rtype:
str
location_post_setup(location)Perform post-setup operations on a location.
open()Open connection to the building management system.
put_setpoint_schedule(schedule, control_unit)Upload a setpoint schedule to a control unit.
update_location_cache(location)Attributes
building_modelconfig- close()
Close connection to the building management system.
This method should clean up resources, close connections, and perform any necessary cleanup operations.
- get_all_locations_collection()
Retrieve a collection containing all available locations.
- Returns:
Collection with all locations
- Return type:
- get_all_locations_information()
Retrieve information about all available locations.
- Returns:
List of location information objects
- Return type:
list[LocationInformation]
- get_comfort_profile_setpoints(date_range, location)
Retrieve comfort profile setpoints for a location and date range.
- Parameters:
- Returns:
List of comfort profiles
- Return type:
list[ComfortProfile]
- get_devices(location_id)
Retrieve all devices for a specific location.
- Parameters:
location_id (int) – ID of the location
- Returns:
List of devices in the location
- Return type:
list[Device]
- get_electricity_prices(date_range, unit, include_vat=True, include_tariff=True, timestamp_type=TimestampType.ISO)
Retrieve electricity prices for a unit and date range.
- Parameters:
- Returns:
Electricity price data
- Return type:
- get_features(location_id)
Retrieve available features for a specific location.
- Parameters:
location_id (int) – ID of the location to query
- Returns:
Available features for the location
- get_location(location_id)
Retrieve a specific location by ID.
- Parameters:
location_id (int) – ID of the location to retrieve
- Returns:
Location object
- Return type:
- Raises:
ValueError – If location ID is not found
- get_locations(location_ids)
Retrieve multiple locations by their IDs.
- Parameters:
location_ids (list[int]) – List of location IDs to retrieve
- Returns:
List of location objects
- Return type:
list[Location]
- Raises:
ValueError – If any location ID is not found
- get_price_components(supply_point_ids)
Retrieve price components for specified supply points.
- Parameters:
supply_point_ids (list[int]) – List of supply point IDs
- Returns:
Dictionary mapping supply point IDs to their price components
- Return type:
dict[int, list[AppliedPriceComponent]]
- get_price_data(date_range, price_component_ids, timestamp_type=TimestampType.ISO)
Retrieve price data for specified components and date range.
- get_setpoint_schedule(date_range, control_unit)
Retrieve setpoint schedule from a control unit.
- Parameters:
- Returns:
Setpoint schedule
- Return type:
- load_measurements(components, date_range, timestamp_type=TimestampType.ISO)
Load measurement data for specified components and date range.
This method loads measurement data into the components’ internal storage, typically for later retrieval or analysis.
- location_post_setup(location)
Perform post-setup operations on a location.
This method is called after a location has been created and allows the adapter to perform any additional setup or configuration.
- Parameters:
location (Location) – Location that was just created
- Example:
>>> # Default implementation does nothing >>> class TestAdapter(Adapter): ... def location_post_setup(self, location): ... pass # Custom setup logic would go here >>> >>> # Method exists and is callable >>> hasattr(Adapter, 'location_post_setup') True
- open()
Open connection to the building management system.
This method should establish any necessary connections, authenticate, and prepare the adapter for data operations.
- Raises:
ConnectionError – If connection cannot be established
- put_setpoint_schedule(schedule, control_unit)
Upload a setpoint schedule to a control unit.
- Parameters:
schedule (SetpointSchedule) – Setpoint schedule to upload
control_unit (Unit) – Control unit to receive the schedule
- Returns:
HTTP response from the upload operation
- Return type:
Response
- Raises:
ValueError – If schedule or control unit is invalid