Close

Home Assistant integration

A project log for Air Quality station

Air Quality monitoring (standalone & compatible with Home Assistant)

jp-gleyzesJP Gleyzes 06/29/2026 at 17:330 Comments

MQTT

So you have now your firmware ready to send data to a MQTT broker.

But what is it ?

MQTT stands for "Message Queuing for Telemetry Transport". 

"MQTT is a Client Server publish/subscribe messaging transport protocol. It is lightweight, open,
simple, and designed so as to be easy to implement.
These characteristics make it ideal for use in many situations, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) contexts."

More precisely, MQTT embodies all the aspects of pub/sub:

• MQTT decouples the publisher and subscriber spatially. To publish or receive messages, publishers and subscribers only need to know the hostname/IP and port of the broker
• MQTT decouples by time. If desired, the broker can store messages for clients that are not online. 
• MQTT works asynchronously. Because most client libraries work asynchronously and are based
on callbacks or a similar model, tasks are not blocked while waiting for a message or publishing
a message. 
• MQTT is especially easy to use on the client-side. Most pub/sub systems have the logic on the brokerside.

Although communication can be bidirectionnal, for our simple sensors, we will only use the client to broker publication (left side of the above picture)

So we need now to host a MQTT broker into Home Assistant for the sensor to publish values

And Home Assistant will have (internally) to subscribe to these messages to use these data (right side of the picture)


Adding a MQTT broker in HA

Follow this tutorial into Home Assistant

For MQTT broker to be allowed to speak to Home Assistant it must be declared as a "user"

So add a new user (MQTT_Broker) and enter its credentials (same as the ones you have choosen when compiling the firmware)

Your broker is now ready to listen to messages. click on it and try to listen to "all messages" by typing "#" and start Listening

if your AirQuality station is running then you should see the sensors coming every 5 minutes !

But they are not yet integrated into your dashboards

sensors integration

The most easy way to select your new sensors is to go to Settings >Devices and services then select "devices",  and you should see your new AirQuality sensors. 

You can then add the to any area you want (I have choosen "Mezzanine" which is at the first floor !)

When added to an area then click on it, into the main screen, and you will see sensors attached to this area

 Going further

You have now access at the full power of Home Assistant!

You can create a new dashboard

then add any view you want

And finally get the "perfect dashboard" ! (don't look too closely at the pressure chart... I changed the "sea level" value around 3pm !)

Discussions