Skip to content

Getting Started

This guide walks you through setting up airthings2mqtt on a Raspberry Pi, connecting to your Airthings Wave sensor over BLE, and verifying that data flows to your MQTT broker.

Prerequisites

Requirement Details
Raspberry Pi Any model with Bluetooth (Pi ¾/5 or Zero 2 W)
Airthings Wave Wave (1st-gen), or Wave 2 / Wave Radon (2nd-gen); BLE-capable. The protocol generation is auto-detected per connection.
BlueZ Linux Bluetooth stack, 5.55 or newer (pre-installed on Raspberry Pi OS)
MQTT broker Mosquitto, EMQX, or any MQTT 3.1.1+ broker
Python 3.14+ (Docker image includes this)

The image cannot see the host's BlueZ version, so check it on the host with bluetoothctl --version. At the first connection the app logs one bleak warning, Could not determine BlueZ version, bluetoothctl not available, assuming 5.55+. That is expected and harmless when the host meets the requirement.

Finding Your Sensor MAC Address

airthings2mqtt needs the Bluetooth MAC address of your Airthings Wave sensor. Use bluetoothctl to find it:

bluetoothctl scan on

Look for a device name starting with "Airthings". The MAC address format is XX:XX:XX:XX:XX:XX. Once found, press Ctrl+C to stop the scan.

Scan timeout

The sensor may take 30--60 seconds to appear. Make sure Bluetooth is enabled: sudo systemctl status bluetooth should show active (running).

BLE range

Bluetooth Low Energy range is typically 5--10 metres indoors. Place the Raspberry Pi within range of the sensor for reliable readings.


Installation

Docker is the simplest way to run airthings2mqtt. Create a directory on your Pi, copy this compose.yml into it, and you're ready to go:

compose.yml
services:
  airthings2mqtt:
    image: ghcr.io/ff-fab/airthings2mqtt:latest
    restart: unless-stopped
    network_mode: host
    security_opt:
      - no-new-privileges:true
    env_file: .env
    environment:
      AIRTHINGS2MQTT_MQTT__HOST: localhost
      AIRTHINGS2MQTT_MQTT__TLS: ${AIRTHINGS2MQTT_MQTT__TLS:-false}
    volumes:
      - airthings2mqtt-data:/app/data
      - /var/run/dbus:/var/run/dbus:ro
    depends_on:
      - mosquitto

  mosquitto:
    image: eclipse-mosquitto:2
    restart: unless-stopped
    ports:
      - '127.0.0.1:1883:1883'
    volumes:
      - ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
      - mosquitto-data:/mosquitto/data
      - mosquitto-log:/mosquitto/log

volumes:
  airthings2mqtt-data:
  mosquitto-data:
  mosquitto-log:

Create the host account for the container user (UID 10001). Without it the host's D-Bus refuses the container and no reading arrives. The details, and the steps for upgrading from 0.2.x, are in Host Setup:

sudo groupadd --system --gid 10001 airthings2mqtt
sudo useradd --system --uid 10001 --gid 10001 --no-create-home \
    --shell /usr/sbin/nologin airthings2mqtt

Then download the Mosquitto config and create your env file:

curl -fsSL https://raw.githubusercontent.com/ff-fab/cosalette-apps/main/apps/airthings2mqtt/mosquitto.conf -o mosquitto.conf
curl -fsSL https://raw.githubusercontent.com/ff-fab/cosalette-apps/main/apps/airthings2mqtt/.env.example -o .env
# Edit .env with your sensor MAC address
# Start airthings2mqtt + Mosquitto
docker compose up -d

The container uses network_mode: host to access the host D-Bus for Bluetooth.

Download everything at once

Prefer curl over copy-paste? Grab all three files in one go:

curl -fsSL https://raw.githubusercontent.com/ff-fab/cosalette-apps/main/apps/airthings2mqtt/compose.yml -o compose.yml
curl -fsSL https://raw.githubusercontent.com/ff-fab/cosalette-apps/main/apps/airthings2mqtt/mosquitto.conf -o mosquitto.conf
curl -fsSL https://raw.githubusercontent.com/ff-fab/cosalette-apps/main/apps/airthings2mqtt/.env.example -o .env

Pin to a specific version

Replace latest with a release tag (e.g. 0.1.0) in the image: line to pin the deployment and avoid surprises on restart.

BlueZ and D-Bus access

BLE communication requires access to the host Bluetooth stack via D-Bus. The compose file mounts /var/run/dbus for BlueZ access and needs no added capabilities. security_opt: no-new-privileges stops the container from gaining any. network_mode: host avoids additional network configuration. See Host Setup.

The app health check only reads BlueZ's Adapter1.Powered property over D-Bus, with a bounded timeout, every 30 seconds. It reuses one system-bus connection and reconnects after a bus error or a dbus restart. It reports unhealthy when D-Bus is unavailable, no Bluetooth adapter is present, or the adapter is powered off. The check does not scan for or connect to the configured Airthings sensor; terminal BLE read retry failures are reported separately on the device availability topic.

The app never power-cycles or resets the adapter and has no restart settings: it recovers by retrying on the next poll, and recovering the adapter is the host's job (ADR-003). The :ro socket mount and non-root user do not by themselves stop D-Bus writes; only the host's D-Bus/BlueZ policy does. An opt-in policy that enforces this is in Host Setup.

Health over MQTT, shown on the host by the image probe

Watch airthings2mqtt/status and airthings2mqtt/airthings/availability: they report a stale sensor and a dead app. The image's Docker HEALTHCHECK shows the same state in docker ps, but an unhealthy container is not restarted. If the sensor stays stale for 5 hours, the app exits with code 5 and restart: unless-stopped starts it again. See Troubleshooting.

Install airthings2mqtt directly on your Pi:

pip install airthings2mqtt
# or with uv:
uv pip install airthings2mqtt

Create a .env file or set environment variables, then run:

airthings2mqtt

airthings2mqtt reads .env from the current directory by default.


First Run Verification

Once airthings2mqtt is running, verify data is flowing by subscribing to the MQTT topics. The examples use the default topic prefix (airthings2mqtt) and device name (airthings); substitute your configured values if you changed either setting.

Check Status

mosquitto_sub -h localhost -t "airthings2mqtt/#" -v

You should see messages on these topics within the first polling cycle:

Topic What it means
airthings2mqtt/status Heartbeat --- the app is alive
airthings2mqtt/airthings/availability Reachability after retryable reads
airthings2mqtt/airthings/state First sensor reading (see below)

Verify Sensor Data

The airthings2mqtt/airthings/state topic should contain a JSON payload with your sensor readings:

{
  "temperature": 21.5,
  "humidity": 45.0,
  "radon_24h_avg": 42,
  "radon_long_term_avg": 38,
  "last_read": "2026-10-01T18:34:58.123456Z",
  "rssi": -71
}

Polling interval

The default polling interval is 1500 seconds (25 minutes). The first reading arrives shortly after startup; subsequent readings follow the configured interval. See Configuration to adjust.

To request a fresh reading on demand, publish an empty payload to the trigger topic (substituting your configured prefix and device name when needed):

mosquitto_pub -h localhost -t "airthings2mqtt/airthings/set" -n

No messages?

  • Confirm the broker is reachable: mosquitto_pub -h localhost -t test -m hello
  • Check airthings2mqtt logs: docker compose logs airthings2mqtt or the terminal output
  • Verify Bluetooth: bluetoothctl show should list your controller
  • Check the sensor is in range: bluetoothctl scan on should show your Airthings device
  • Still stuck? Work through Troubleshooting

Next Steps

  • Host Setup --- the container user's host account and optional hardening
  • Configure MQTT connection, polling intervals, and logging
  • MQTT Topics --- full topic reference with payload schemas
  • Troubleshooting --- an offline sensor and the operator runbook