Awair Air Quality

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/:

  1. Using your Awair credentials (used for the mobile application), request access to the Developer Console
  2. 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:

  1. Create app by copying and pasting app code into Hubitat
  2. Create driver by copying and pasting driver code into Hubitat
  3. Add User App "Awair (Connect)"
  4. When requested, enter your access token
  5. Your Awair devices should then be retrieved and you can select which ones to install in Hubitat
  6. Before completing, you can indicate whether you want to retrieve Temperature information in Fahrenheit (default is Celsius)
  7. 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

4 Likes

Appears to work with my Awair R2... no issues so far - thanks!

Thanks for letting me know, happy it is working.

Thanks Pedro,

This is great stuff. I got two AWAIR OMNI's on my Hubitat. They include lux and dba and they appear to be reading well. A couple of questions (sorry if they sound stupid, I am pretty new to Hubitat and automation in general):

  1. Is there an option to create a dashboard tile that succinctly displays all parameters? Currently I use the "attribute" tile, which only allows me to display one measurement.
  2. How do I increase polling frequency? On the direction it states to modify something on line 240 but I'm assuming you'd modified the code since writing the instructions as I don't see a line that can be changed to increase/decreasing frequency. I look at lines around 240 and I have found some mentions of polling but it's unclear what I need to modify to increase the polling frequency.

Thanks and great work!

E

Hi ericysun, glad you found it useful.

  • for tile with multiple attributes, I am using Tilemaster (do a search in the forum).
  • for polling frequency, line 240 sets the polling frequency. You should be able to change to e.g. runEvery2Minutes for example. In any case, in my installation I am using a RuleMachine rule to refresh this and other devices, instead of the polling schedule in the code, you can look into this

Cheers
Pedro

Just added the app with my Element and it seems to be working with all the expected parameters. No issues so far...thanks for writing this!

posted a Driver for AwAir Elements

post: [Release] AwAir Elements Driver

Download the Hubitat app