Hi everyone
my first post here. Spent a couple days trying to learn Hubitat apps and drivers, and created a simple solution for polling Awair devices for air quality data.
Important note: I only have an Awair R1, but tried to write the code as to support other types of devices, based on documentation. Nevertheless, only tested with Awair R1. Also, bear with me in case of issues, as it is my first attempt at writing something for Hubitat, and I haven't done much development in the last years (used to back in the day...)
In order to use this connector you need to register for a Developer Console access token at https://developer.getawair.com/:
- Using your Awair credentials (used for the mobile application), request access to the Developer Console
- When approved (can take a couple days), log into the Developer Console and retrieve the access token. You will use this to setup access through Hubitat
To use:
- Create app by copying and pasting app code into Hubitat
- Create driver by copying and pasting driver code into Hubitat
- Add User App "Awair (Connect)"
- When requested, enter your access token
- Your Awair devices should then be retrieved and you can select which ones to install in Hubitat
- Before completing, you can indicate whether you want to retrieve Temperature information in Fahrenheit (default is Celsius)
- You can also indicate whether you want to store data with 0, 1 or 2 decimal places. I use this in order to display correctly in Dashboard tiles
Additional settings:
- in App code, row 26, you can set debug level: 1 is trace level (everything), 5 is error only
- in App code, row 240, you can set polling refresh frequency. I usually comment this out, as I refresh based on a rule in RM
Enjoy, and feel free to let me know of any issues and I will try to address.
My objectives for improving:
- implement changing settings on the device from Hubitat
- implement oauth so token is not needed
Cheers
Pedro