API Reference
- class datareadingrequests.DataReading(quantity: float, unit: str)
A data reading from a meter, with a quantity and a unit.
- property quantity
Alias for field number 0
- property unit
Alias for field number 1
- exception datareadingrequests.NoDataReading(facility, instance)
Raised when server returns no data reading.
- exception datareadingrequests.NoResponseList(bulk_request)
Raised when server returns no response list.
- exception datareadingrequests.UnsuccessfulRequest
Raised when a request sent to the server is unsuccessful.
- datareadingrequests.get_bulk(bulk_request: Iterable[Dict]) Dict
Get readings in bulk from Building Energy Gateway.
Although mostly compatible with building_data_requests’ function of the same name, note that if the server returns no data for any specific instance, datareadingrequests’ version will raise an exception.
- Parameters
bulk_request – An iterable, with each item specifying one instance. Each item should be a dictionary with keys “facility”, “instance”, and “label”. “label” is optional.
- Returns
A dictionary representing the server’s JSON response. Inside this dictionary is [“rsp_list”], a list of the readings. [“rsp_list”] can be used to create a Pandas DataFrame.
- datareadingrequests.get_value(facility, instance, live=False) datareadingrequests.DataReading
Get the reading of a meter through Building Energy Gateway.
Although mostly compatible with building_data_requests’ function of the same name, note that if the server returns no data, datareadingrequests’ version will raise an exception.
- Parameters
facility – The facility in which the meter is located.
instance – The meter’s number.
live – (optional) Whether to get a live reading. By default, the function will get a cached reading.
- Returns
a DataReading namedtuple consisting of (quantity, unit).
- datareadingrequests.send_get_request(args)
Send an HTTP GET request to Building Energy Gateway.
This is the datareadingrequests equivalent of building_data_requests’ post_request(). Note that it does not retry requests without SSL.
- Parameters
args – Arguments for the request.
- Returns
Response object.