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!

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.

1 Like

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

It worked fine for me for a while. But the entities from alexa media player stopped work since a few weeks. Seems like the reason is a update. Has anyone the same problem. Did you fix it? It looks like the values from the smart air quality monitors are just not forwarded to home assistant any more.

Go to Integrations > Alexa Media Player > Configure

Make sure include devices connected via Echo is checked.

Thank you. I didn’t set check box. Now i did. But it didn’t change. I looked into the entity e.g. humidity and it says that this entites are not provided by the “alexa-media”-integration.

I am using 5.1.0 of the alexa media player. Are you using the same version? Does it work?

Give it a bit.

Hey, I played around with old version and it seemed that not (only) the alexa media player but the HASS - core update from 2024.2.1. to 2024.12.3 is at least also causing this problem. Lets see if it will be fixed


did anybody of you make it, to get the Alexa/Amazon air quality sensor integrated again into home assistant?

Yes

I deleted the Alexa media player Integration and set it up again. But the entities from the air quility are not there. How did you do it? i have the current version of the alexa media player (5.4.0.)

I selected “Include devices connected via Echo” as per the instructions. Did you? Just check the Configure button in the integration and reload it if after you check it.