Awair Local Sensors

Thanks for sharing, this validated what I had. I actually ended up splitting my configuration.yaml into a sub sensor.yaml as recommended and now everything is working via the local API.

Thanks again and thank you @richieframe for writing this all out originally. I really love the HA community!

1 Like

Could someone help me with this setup? The sensors all show as ā€œunavailable,ā€ except for the ā€œmain sensorā€ for the device itself.

I can click on the ā€œmain sensorā€ attributes and get values, so I know Iā€™m getting the data.

Here is my YAML. I have it in /config/sensors.yaml. It is copied and pasted from above with just changing the names.

I have also enabled the Local API via the Awair app.

# Awair
  - platform: rest
    name: awair_1st_floor
    resource: http://192.168.1.41/air-data/latest
    scan_interval: 60
    json_attributes:
      - timestamp
      - score
      - dew_point
      - temp
      - humid
      - abs_humid
      - co2
      - co2_est
      - voc
      - voc_baseline
      - voc_h2_raw
      - voc_ethanol_raw
      - pm25
      - pm10_est
    value_template: 'OK'

  - platform: template
    sensors:
      awair_1st_floor_score:
        unique_id: aw-1-s
        friendly_name: "1st Floor Awair Score"
        value_template: '{{ states.sensor.awair_1st_floor_sensors.attributes["score"] }}'
        unit_of_measurement: '%'
      awair_1st_floor_temp:
        unique_id: aw-1-t
        friendly_name: "1st Floor Awair Temperature"
        value_template: '{{ states.sensor.awair_1st_floor_sensors.attributes["temp"] }}'
        device_class: temperature
        unit_of_measurement: 'Ā°C'
      awair_1st_floor_humid:
        unique_id: aw-1-h
        friendly_name: "1st Floor Awair Humidity"
        value_template: '{{ states.sensor.awair_1st_floor_sensors.attributes["humid"] }}'
        device_class: humidity
        unit_of_measurement: '%'
      awair_1st_floor_co2:
        unique_id: aw-1-co2
        friendly_name: "1st Floor Awair CO2"
        value_template: '{{ states.sensor.awair_1st_floor_sensors.attributes["co2"] }}'
        unit_of_measurement: 'ppm'
      awair_1st_floor_voc:
        unique_id: aw-1-voc
        friendly_name: "1st Floor Awair VOC"
        value_template: '{{ states.sensor.awair_1st_floor_sensors.attributes["voc"] }}'
        unit_of_measurement: 'ppb'
      awair_1st_floor_pm25:
        unique_id: aw-1-pm
        friendly_name: "1st Floor Awair PM2.5"
        value_template: '{{ states.sensor.awair_1st_floor_sensors.attributes["pm25"] }}'
        unit_of_measurement: 'Ī¼g/mĀ³'
        
  - platform: rest
    name: awair_3rd_floor
    resource: http://192.168.1.43/air-data/latest
    scan_interval: 60
    json_attributes:
      - timestamp
      - score
      - dew_point
      - temp
      - humid
      - abs_humid
      - co2
      - co2_est
      - voc
      - voc_baseline
      - voc_h2_raw
      - voc_ethanol_raw
      - pm25
      - pm10_est
    value_template: 'OK'

  - platform: template
    sensors:
      awair_3rd_floor_score:
        unique_id: aw-3-s
        friendly_name: "3rd Floor Awair Score"
        value_template: '{{ states.sensor.awair_3rd_floor_sensors.attributes["score"] }}'
        unit_of_measurement: '%'
      awair_3rd_floor_temp:
        unique_id: aw-3-t
        friendly_name: "3rd Floor Awair Temperature"
        value_template: '{{ states.sensor.awair_3rd_floor_sensors.attributes["temp"] }}'
        device_class: temperature
        unit_of_measurement: 'Ā°C'
      awair_3rd_floor_humid:
        unique_id: aw-3-h
        friendly_name: "3rd Floor Awair Humidity"
        value_template: '{{ states.sensor.awair_3rd_floor_sensors.attributes["humid"] }}'
        device_class: humidity
        unit_of_measurement: '%'
      awair_3rd_floor_co2:
        unique_id: aw-3-co2
        friendly_name: "3rd Floor Awair CO2"
        value_template: '{{ states.sensor.awair_3rd_floor_sensors.attributes["co2"] }}'
        unit_of_measurement: 'ppm'
      awair_3rd_floor_voc:
        unique_id: aw-3-voc
        friendly_name: "3rd Floor Awair VOC"
        value_template: '{{ states.sensor.awair_3rd_floor_sensors.attributes["voc"] }}'
        unit_of_measurement: 'ppb'
      awair_3rd_floor_pm25:
        unique_id: aw-3-pm
        friendly_name: "3rd Floor Awair PM2.5"
        value_template: '{{ states.sensor.awair_3rd_floor_sensors.attributes["pm25"] }}'
        unit_of_measurement: 'Ī¼g/mĀ³'

Any idea what Iā€™m doing wrong here?

You have a ā€œ_sensorsā€ in the template value but not in the rest sensor name, either remove it from the template or add it to the rest sensor.

Thank you @richieframe, not sure how I missed that!

FYI HomeAssistant 2022.9 now has local Awair support via integration

3 Likes

Thanks @richieframe for sharing your code! Using this I have been able to set it up. I did notice on the first day that the connection got interrupted twice which resulted in some data loss. The last 2 days it has been running fine however. Power consumption is pretty decent with 1.2 wattage.

I have made a step-by-step walkthrough for anyone who is interested. This covers all the steps Iā€™ve taken including factory resetting the device and enabling the local API in the iOS app. Iā€™ve used the RESTful sensor by the way, only found out later that the integration was already included in HA.

Feel free to provide feedback and/or ask questions!

2 Likes

Can someone tell me how quickly the temperature readings update in the Awair? Wondering if I can use it to control a roomā€™s heater based on temp readings. I have a zwave sensor now that updates quite quickly but would prefer to consolidate devices.

Every 30 seconds.

1 Like

Hey @richieframe
Iā€™m thinking about getting an awair element v2 to use it with local api in Home Assistant only. But Iā€™ve just found out about the companyā€™s bad reputation due to dropping support for the V1 devices.

So I wanted to know what happens, if you block the internet access of the device. Does it still shows the clock?
(The V1 devices are not able of displaying the time, because the made a breaking change to the time API endpointā€¦)

Hey @Mondmonarch

not sure if this is the right place for this question, But yes it still displays the clock when blocked; even after restart. but i cant tell you for how long the time will by correct.

1 Like