This manual guides you through how to easily integrate Airthings IAQ data into your Niagara 4 station using the ossEasyAPI module from One Sightsolutions.
Firstly, sign in to dashboard.airthings.com with your administrator user, go to the Integration page,
select API, and add a new API client.
Select the scope “read_device” and use “Client credentials (user-authorization)” authentication flow with confidential access.
Using the URL:
accounts.airthings.com/authorize?client_id={YourClientId}&redirect_uri={YourRedirectUri}
Input your ID and redirect uri, it will look like the following
accounts.airthings.com/authorize?client_id=f0ff6491-xx78-x45x-x67x-xx3x9xx28123&redirect_uri=https://onesight.solutions
Input your custom URL into a browser, this will take you this page where you login, doing this will
authorise the api client you are using.
You will be redirected to the website that you input into your API client
You will be returned a code within the url like the following:
Now head over to workbench on Niagara 4…
Now on Niagara 4, we need to send this code back to Airthings to receive our bearer token.
On a wiresheet, drag an API request from the ossEasyAPI palette and fill in with the following:
Url: https://accounts-api.airthings.com/v1/token
Method: post
Save and refresh
Right click on Http Header and add: Content-Type: application/json
: application/json
Http Body:
{
“grant_type”: “authorization_code”,
“client_id”: “xsbx9a7d-adxx-4281-xyzx-3f12345676fe3”,
“client_secret”: “82bfed8b-xxxx-xxxx-xxxx-7491xxx354a0”,
“code”: “auth-code-from-authorize”,
“redirect_uri”: “https://redirect.configured.for.client”
}
Fill in with your credentials: ID, sercret, code from above step and redirect the url
Save, then right click on ApiRequest/action/send request
The tokens received only last 3 hours and another call request needs to be made to refresh these.
Regarding this, our ossAirThings manager automatically refreshes the tokens for you every 2:30 hours.
Fill the fields with your credentials: Client ID, Client Secret and the access & refresh tokens requested from the first request.
‘Use Location Folders’ – If enabled the devices will be placed in folders according to the location defined
for that device in the Airthings dashboard.
‘Use Segment Name’ – If enabled the names of the devices will be set to the device name defined in the
Airthings dashboard.
If either of these options are changed the Airthings manager should be disabled and re-enabled for the
devices to be updated correctly.
Once filled in, enable the manager and it will automatically send the request for the data.
The module puts the data returned into a Niagara 4 file structure for you to utilise easily.
Leverage the data and create visual and informative PX pages and dashboards for internal and end user use.
The OSS Airthings Manager is available in a separate module from ossEasyAPI and has it’s own palette.
For more information, click the links below: