Onboard Data Python API documentation

https://readthedocs.org/projects/onboard-docs-test/badge/?version=latest https://badge.fury.io/py/onboard.client.svg https://shields.io/pypi/pyversions/onboard.client.svg https://camo.githubusercontent.com/3656aeb94541a2464bac21509c34b7942cf127702885cd6ce0002120d2bfa189/68747470733a2f2f696d672e736869656c64732e696f2f707970692f6c2f6f6e626f6172642e636c69656e74

This package provides Python bindings to Onboard Data’s building data API, allowing easy and lightweight access to building data.

For example, we can retrieve the last week of temperature data from all Zone Temperature points associated with FCUs in the Laboratory building:

import pandas as pd
from onboard.client import OnboardClient
from onboard.client.dataframes import points_df_from_streaming_timeseries
from onboard.client.models import PointSelector, TimeseriesQuery, PointData
from datetime import datetime, timezone, timedelta
from typing import List
import pytz
client = OnboardClient(api_key='your-api-key-here')

print(list(pd.DataFrame(client.get_all_buildings())['name'])) # returns list of buildings that you have access to (you may not have 'Laboratory' in your set)

query = PointSelector()
query.point_types     = ['Zone Temperature'] # can list multiple point
query.equipment_types = ['fcu']              # types, equipment types,
query.buildings       = ['Laboratory']       # buildings, etc.
selection = client.select_points(query)

start = datetime.now(pytz.utc) - timedelta(days=7)
end   = datetime.now(pytz.utc)

timeseries_query = TimeseriesQuery(point_ids = selection['points'], start = start, end = end)
sensor_data = points_df_from_streaming_timeseries(client.stream_point_timeseries(timeseries_query))

and to plot:

import matplotlib.pyplot as plt
import numpy as np
# set the timestamp as the index and forward fill the data for plotting
sensor_data_clean = sensor_data.set_index('timestamp').astype(float).ffill()
# Edit the indexes just for visualization purposes
indexes = [i.split('T')[0] for i in list(sensor_data_clean.index)]
sensor_data_clean.index = indexes
fig = sensor_data_clean.plot(figsize=(15,8), fontsize = 12)
fig.set_ylabel('Farenheit',fontdict={'fontsize':15})
fig.set_xlabel('time stamp',fontdict={'fontsize':15})
plt.show()
_images/plot.png

For installation instructions, and to get set up with API access, refer to Initial Setup.

Note

While we are committed to backwards-compatibility, this project is under active development. If you discover a feature that would be helpful, or any unexpected behavior, please contact us at support@onboarddata.io.

Contents

License

Copyright 2018-2022 Onboard Data Inc

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.