Integrate Amazon Smart Air Quality Monitor

I know this thread is a bit old, but i just stumbled upon it trying to add these sensors to HA and wanted to add this in case it helps anyone else with troubleshooting.

I was having this exact problem of them not showing up in HA after following the steps, the reason it was happening was because the echos which the AQMs were connected to were my wifes amazon account. The alexa media player was logged into my amazon account. When i removed my account and re-logged in with her account, the sensors finally showed up after follow the steps outlined here.

Thanks to everyone whoā€™s contributed to figuring out this workaround, it saved me alot of money not getting more airthings sensors for this!

Is there any ā€œDIYā€ Echo device or open source software to simulate an Echo?

I currently use two of these monitors via Alexa App only - no need for an echo device - but to connect with Home Assistant I need one.

Iā€™d like to find an alternative to putting an Amazon microphone in my house :smile:

2 Likes

Yes there is. After a lot of try and error I found a method to be working. I am using a openHab instance using official openHab docker container.

There is a plugin to retrieve sensor data from AQM without having it connected to an echo. ATM I am not at home but I think it is this one ā€œAmazon echo controlā€

With this you can add ā€œthingsā€ which references the AQM sensor data.
The sensor data is then published via MQTT.
In home assistant I just added mqtt sensors to read the values from the published messages

Most of the time this works reliable. Sometimes my openHab instance fails to fetch sensor data. To fix that I simply restart the openHab instance. Once I needed to re-authenticate the plug-in via Amazon login.

Enjoy!

I love the progress for this! Iā€™m sitting on a Amazon AQM just to see if I can ever pull the data off local.

Although, Iā€™m not really interested in running an entire other home automation system just to get the AQM to work. Is there a plugin for HA that would make this easier?

Hi folks,

Iā€™m not sure to understand (Iā€™m French :smiley:). Do I need an Amazon gateway to connect it to Home Assistant ?

Thanks,

So I spent like 3 days setting this up without an echo and with OpenHab + misquitto.

And finally works.

here are my steps.

  1. Using docker to create all openhab and mosquitto:
version: "3.7"

services:
  mosquitto:
    network_mode: host
    image: eclipse-mosquitto
    container_name: mosquitto
    restart: unless-stopped
    ports:
      - "1883:1883"
      - "9001:9001"
    volumes:
      - "<redacted>/configs/mosquitto/config:/mosquitto/config:rw"
      - "<redacted>/configs/mosquitto/data:/mosquitto/data:rw"
      - "<redacted>/configs/mosquitto/log:/mosquitto/log:rw"
version: '2.2'

services:
  openhab:
    image: "openhab/openhab:4.1.3"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "<redacted>/configs/openhab/addons:/openhab/addons"
      - "<redacted>/configs/openhab/conf:/openhab/conf"
      - "<redacted>/configs/openhab/userdata:/openhab/userdata"
    environment:
      CRYPTO_POLICY: "unlimited"
      USER_ID: 999
      GROUP_ID: 998
      OPENHAB_HTTP_PORT: "11080"
      OPENHAB_HTTPS_PORT: "11443"

setting up openhab:

I use Smarthome/J Amazon Echo Control to connect to the AQN (amazon air quality monitor). You need to add https://download.smarthomej.org/addons.json under Setting - > Json 3rd Party Add-on Service to make it available.
With I created these two things:

This custom plugin recognizes all sensors on AQN. I created items from the thingā€™s channel (crazy terminology).

With the MQTT binding I connected to the mosqitto MQTT server (I set it up all open as it can be only accessed from localhost). This way I only needed to set the ip address (no password is need. port is 1883, so no security layer), when I was configuring the MQTT binding.

Then I created this MQTT config script. This will tell HA that the sensors exists and where their values are. (you can do this in the HA config yaml too, but I wanted MQTT discovery to work):

/**
 * Publishes commands and updates to the configured topic.
 */
var pubEvent = () => {
  console.debug('Publishing an event bus event');
  console.log(event);
  var config_topic = 'homeassistant/sensor/aqmTemp/config';
  var config = {
                unique_id: "aqmTemp",
                device_class: "temperature",
                name: "Temperature",
                state_topic: "homeassistant/sensor/aqm/state",
                unit_of_measurement: "Ā°C",
                value_template: '\{\{ value_json.Air_Quality_Monitor_Temperature}}',
                device: {
                  name: "Amazon Smart Air Quality Monitor",
                  identifiers:["aqn"]
                }
               }
                
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(config_topic, JSON.stringify(config));
  var config_topic = 'homeassistant/sensor/aqmHum/config';
  var config = {
                unique_id: "aqmHum",
                device_class: "Humidity",
                name: "Humidity",
                state_topic: "homeassistant/sensor/aqm/state",
                unit_of_measurement: "%",
                value_template: '\{\{ value_json.Air_Quality_Monitor_Humidity}}',
                device: {
                  name: "Amazon Smart Air Quality Monitor",
                  identifiers:["aqn"]
                }
               }
                
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(config_topic, JSON.stringify(config));
  var config_topic = 'homeassistant/sensor/aqmCO/config';
  var config = {
                unique_id: "aqmCO",
                device_class: "carbon_monoxide",
                name: "Carbon Monoxide",
                state_topic: "homeassistant/sensor/aqm/state",
                unit_of_measurement: "ppm",
                value_template: '\{\{ value_json.Air_Quality_Monitor_Carbon_Monoxide}}',
                device: {
                  name: "Amazon Smart Air Quality Monitor",
                  identifiers:["aqn"]
                }
               }
                
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(config_topic, JSON.stringify(config));
  var config_topic = 'homeassistant/sensor/aqmVOC/config';
  var config = {
                unique_id: "aqmVOC",
                device_class: "volatile_organic_compounds_parts",
                name: "VOC",
                state_topic: "homeassistant/sensor/aqm/state",
                unit_of_measurement: "ppm",
                value_template: '\{\{ value_json.Air_Quality_Monitor_VOC}}',
                device: {
                  name: "Amazon Smart Air Quality Monitor",
                  identifiers:["aqn"]
                }
               }
                
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(config_topic, JSON.stringify(config));
  
  var config_topic = 'homeassistant/sensor/aqmPM25/config';
  var config = {
                unique_id: "aqmPM25",
                device_class: "pm25",
                name: "PM2.5",
                state_topic: "homeassistant/sensor/aqm/state",
                unit_of_measurement: " Āµg/mĀ³",
                value_template: '\{\{ value_json.Air_Quality_Monitor_PM25}}',
                device: {
                  name: "Amazon Smart Air Quality Monitor",
                  identifiers:["aqn"]
                }
               }
                
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(config_topic, JSON.stringify(config));
  
  var config_topic = 'homeassistant/sensor/aqmIAQ/config';
  var config = {
                unique_id: "aqmIAQ",
                device_class: "aqi",
                name: "Indoor Air Quality",
                state_topic: "homeassistant/sensor/aqm/state",
                value_template: '\{\{ value_json.Air_Quality_Monitor_Indoor_Air_Quality}}',
                device: {
                  name: "Amazon Smart Air Quality Monitor",
                  identifiers:["aqn"]
                }
               }
                
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(config_topic, JSON.stringify(config));

  
  
}

pubEvent();

This you basically only need to run it once, but I created a rule to send it when there is anew value on any of the senzors.

Then I have this scrip that runs when a senzor has a new value:

/**
 * Publishes commands and updates to the configured topic.
 */
var pubEvent = () => {
  console.debug('Publishing an event bus event');
  
  var topic = 'homeassistant/sensor/aqm/state';
  var multiple = 1;
  switch(event.itemName){
    case 'Air_Quality_Monitor_PM25':
      multiple = 1000000000;
      break;
    case 'Air_Quality_Monitor_Carbon_Monoxide':
      multiple = 1000000;
      break;
  }
  var payload = {};
  payload[event.itemName] = (parseFloat(event.itemState)*multiple);
  var msg = JSON.stringify(payload);
  console.debug('Publish - Topic: ' + topic + ' Message: ' + msg);
  actions.get('mqtt', 'mqtt:broker:57645ab096').publishMQTT(topic, msg, true);
}

pubEvent();

These script assumes that you named your items (senzors) as Air_Quality_Monitor_XXX (see string in the script).

Then I installed MQTT binding to HA and after the config script run, Ha discovered the senzors (and it kinda ā€œjustā€ works).

It is not a super low lever tutorial but I hope some part of them helps ppl.

end result (I canā€™t post more than one photo in one post):

I got fed up with the Amazon AQM appearing and disappearing at random. I got a couple of the Ikea Zigbee AQMs and havenā€™t looked back.

I also have been wanting this for long. Nice work. I just had to set a checkbox that i also want to connect entities, that are connected to my Echo dot. The AQM didnā€™t connect ā€œautomaticallyā€.
Great work. Thank you!!

If someone having issues connecting Amazon AQM with trying all the steps above downgrade Alexa Media Player to the version to v4.10.1 , i was trying everything with v4.11.1 , didnā€™t work for me , in v4.10.1 all AQM sensors showed up !.

1 Like

Hi, I started to work with this AQM, and as some people in this post, Iā€™m interested in collect the data from it to use in a different application. By doing this integration with HA and Alexa Media Player, would I be able to export the data of the monitor by any means? Someone here was able to do this in a maybe different way? thanks

Resurrecting an old post in the hopes that someone has maintained this capability and that it works. I have successfully added the Alexa media player into HACS, depreciated it to v.4.10.1 but I am stuck with getting a failure loop with the third-party authentication; I enter my account name and password but the screen returns to entering account name. Node Red authenticates correctly but not the media player. tia