Awair Air Quality Sensor Integration

Hi,

Has anyone been able to integrate the Awair air quality sensor to their HA?
I believe there is now an API available but not skilled enough to do anything with it!!

Awair does work with IFTTT but also unsure if its possible to send the sensor readings to HA.
Any help or suggestions much appreciated.

They have an API as well.

https://developer.getawair.com/onboard/welcome

I just ordered my Awair air quality sensor. I did not check that Home Assistant doesn’t support Awair. I hope that Awair will be added to HA.

I have obtained an API key from Awair - and have their API documentation - but problem is I am struggling to know what to do with it. I’m sure there is a way but it will take someone with a bit more know-how that me to make it work. Hoping to see it in future releases also as it would be great to have the Awair sensor data displayed on my HA instance, and to be able to build some automations based on the sensor data.

I developed an integration here:

At some point I’ll add it to Home Assistant, but for now the API is still changing too often.

The awair component uses the pyawair API package: https://pypi.org/project/pyawair/

1 Like

Watching, would love to see this integrated into hass.io but i’m too dumb to be able to code it.

Thankyou for providing this! It works! I will enjoy using this.

Has the API changed to break the awair component?

2019-01-13 20:46:09 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform awair
Traceback (most recent call last):
  File "/home/homeassistant/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/home/homeassistant/homeassistant/lib64/python3.6/site-packages/homeassistant/components/sensor/awair.py", line 104, in async_setup_platform
    devices = config.get(CONF_DEVICES, await client.devices())
  File "/home/homeassistant/homeassistant/lib64/python3.6/site-packages/python_awair/__init__.py", line 29, in devices
    return (yield from self._query(const.DEVICE_QUERY))['Devices']['devices']
TypeError: 'GenericError' object is not subscriptable

This is what I see in the console when I try to setup an awair device in my configuration.

It’s still working for me, did you manage to fix it?

Hi takje,
Your component has been working flawlessly, but I’ve recently upgraded to hass.io 0.94 and now see this error in the logs - could you advise please - many thanks!

2019-06-07 06:11:08 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform myawair
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT)
File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 416, in wait_for
return fut.result()
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/myawair/sensor.py”, line 56, in setup_platform
from pyawair.auth import AwairAuth
ModuleNotFoundError: No module named ‘pyawair’

There is an official integration now which should have the same functionality. It could be that the setup is slightly different.

The component broke due to changes in HA. The setup of custom components is different now.

check that you can see your awair devices (lists devices in your account)

/usr/bin/curl --location --request GET “http://developer-apis.awair.is/v1/users/self/devices”
–header “Authorization: Bearer yourtokenhere”

display data from a device, xxxx=your device id

/usr/bin/curl --location --request GET “http://developer-apis.awair.is/v1/users/self/devices/awair-r2/xxxx/air-data/latest?fahrenheit=true”
–header “Authorization: Bearer yourtokenhere”

Thanks for the update

Perferred your custom component as you could name the devices and set the refresh interval

Guess I can copy the official component and use it as a custom component so I can make some changes?

Thanks again for providing this code.

Mat.