My Enviro Urban has been sending particulate readings for eight days, and for seven of them I had no idea whether the numbers were good. PM2.5 of 6 µg/m³. Then 38. Then 3. A chart of that tells you the air changed. It doesn’t tell you whether to open a window.

The World Health Organization publishes levels to compare against, so I added them to the dashboard as two dashed lines, and added the local weather to the temperature, humidity and pressure charts while I was in there. This post covers what the WHO levels are, how to hold your own readings against them properly, and what a week of mine looked like.

The short version:

  • WHO’s 2021 guideline for a 24-hour average is 15 µg/m³ for PM2.5 and 45 µg/m³ for PM10. There’s no level for PM1.
  • Those are averages over a day. A single reading above the line breaks nothing.
  • My worst 24-hour PM2.5 average in eight days was 19.3 µg/m³, over the line. PM10 never got close.
  • The weather overlay uses Open-Meteo, which needs no key or account.

Everything here is in the dashboard from the low-power firmware project. If you’re already running it, pull the new image:

cd enviro-urban-lowpower
docker compose pull
docker compose up -d

What the WHO PM2.5 and PM10 guideline levels are

The numbers come from the WHO global air quality guidelines, published in 2021:

24-hour averageAnnual average
PM2.515 µg/m³5 µg/m³
PM1045 µg/m³15 µg/m³
PM1no level setno level set

Two things about that table tripped me up.

They’re averages. The 24-hour figure is the mean over a whole day. The Enviro Urban takes a few seconds of readings after a 30 second fan run, and comparing one of those to 15 is comparing the wrong things. 31 of my 228 readings were above 15. It takes hours of elevated air to move a day’s mean there.

The annual levels are much lower. A year at 14 µg/m³ would pass the daily level every single day and still be nearly three times the annual one. A week of data can’t tell you anything about a year, so I only draw the daily lines.

The dashed lines on the particulates chart

The particulates chart over seven days with PM1, PM2.5 and PM10 lines and two dashed reference lines labelled WHO day PM2.5 at 15 and WHO day PM10 at 45, showing peaks on 24 and 27 November

The chart marks 15 and 45 µg/m³, with a note underneath saying what they are: levels for a 24-hour average, not for single readings. The PM2.5 line stays on the chart at every zoom level. The PM10 line only appears when the readings get near it, so a quiet day isn’t squashed into the bottom third of the chart to make room for a line nothing is approaching.

That’s a seven day view from my board. It sits indoors, so this is the air in the house and not the air in the street. Two things stand out: an evening peak on 24 November and a longer one around midday on the 27th. Both went past the PM2.5 line. The question is whether either lasted long enough to count.

Working out the 24-hour average yourself

The dashboard keeps every message in data/messages.jsonl, one JSON object per line. This script reads that file, puts the readings into hourly bins, and slides a 24-hour window along them:

#!/usr/bin/env python3
"""Rolling 24-hour PM averages from the dashboard's message log, against WHO's 2021 levels."""
import json, sys
from collections import defaultdict
from datetime import datetime, timezone

WHO_DAY = {"pm2_5": 15, "pm10": 45}   # µg/m³, 24-hour mean
MIN_HOURS = 18                        # a "day" needs readings in at least this many hours

hours = defaultdict(lambda: defaultdict(list))      # hour -> key -> readings
for line in open(sys.argv[1]):
    m = json.loads(line)
    if m.get("retained") or not m["topic"].endswith("/pm"):
        continue
    h = int(datetime.fromisoformat(m["ts"].replace("Z", "+00:00")).timestamp() // 3600)
    for k in WHO_DAY:
        if isinstance(m["payload"].get(k), (int, float)):
            hours[h][k].append(m["payload"][k])

hourly = {h: {k: sum(v) / len(v) for k, v in d.items()} for h, d in hours.items()}
for k, limit in WHO_DAY.items():
    worst, over, windows = (0, None), 0, 0
    for end in sorted(hourly):
        vals = [hourly[h][k] for h in range(end - 23, end + 1) if h in hourly and k in hourly[h]]
        if len(vals) < MIN_HOURS:
            continue
        windows += 1
        mean = sum(vals) / len(vals)
        over += mean > limit
        worst = max(worst, (mean, end))
    when = datetime.fromtimestamp((worst[1] + 1) * 3600, timezone.utc).strftime("%d %b %H:%M UTC")
    print(f"{k:6} worst 24 h mean {worst[0]:5.1f} µg/m³ (ending {when}), "
          f"WHO level {limit}, over it in {over} of {windows} hourly windows")

Save it as pm24.py beside the compose file and point it at the log:

python3 pm24.py data/messages.jsonl

Two details in there are worth copying if you write your own.

  • Average by hour first. If the board reports every minute while it’s charging and every hour on battery, a plain mean of all the readings counts the charging hours sixty times over. Hourly bins give every hour the same weight.
  • Don’t call 5 hours a day. A window needs readings in at least 18 of its 24 hours, or it’s skipped. Otherwise the first evening of data produces a “daily average” from one bad hour.

What a week of readings looked like

This is the output on 29 November, from 228 particulate readings since 21 November. The board wakes every 15 minutes and runs the particulate fan on every fourth wake, so that’s one reading an hour.

pm2_5  worst 24 h mean  19.3 µg/m³ (ending 27 Nov 16:00 UTC), WHO level 15, over it in 33 of 172 hourly windows
pm10   worst 24 h mean  21.5 µg/m³ (ending 27 Nov 16:00 UTC), WHO level 45, over it in 0 of 172 hourly windows
PM2.5PM10
Highest single reading38.3 µg/m³, 27 Nov 11:24 UTC53.3 µg/m³, 24 Nov 16:24 UTC
Single readings over the daily level31 of 2283 of 228
Worst 24-hour mean19.3 µg/m³21.5 µg/m³
24-hour windows over the level33 of 1720 of 172
Mean of every reading8.5 µg/m³10.4 µg/m³

So the answer to “was it bad” is yes for PM2.5, around 27 November, and no for PM10 at any point. Three PM10 readings were over 45 and it didn’t matter, because the worst day around them averaged less than half that.

I haven’t worked out what caused either peak. One sensor in one room can tell you when, and that’s all.

Note: the particulate sensor on this board is a Plantower PMS5003-series optical counter, the cheap kind. It’s good at showing change and it isn’t a reference instrument. Treat a mean of 19.3 as “over the line” and not as a measurement to one decimal place.

Charting the local weather beside the board

A temperature line means more with the outside temperature next to it. Give a board a location under Settings and three of its charts gain a dashed line for the weather outside, with hourly rain as bars underneath.

The temperature chart over seven days with the board steady near 20 degrees, a dashed outside line between 2 and 9 degrees, and bars of hourly rain underneath

  • A location is a UK postcode, such as SW1A 1AA, or a pair of coordinates.
  • The server looks a postcode up once on postcodes.io, when you save it. Only the coordinates go to Open-Meteo after that.
  • It fetches at most every 30 minutes per location and keeps what it has fetched in a weather/ folder beside the settings. The history therefore keeps growing past Open-Meteo’s 92-day window.
  • The Local weather button above the charts hides the overlay again. Setting WEATHER=off in .env stops the server fetching it at all.

The pressure chart needed a correction

The pressure chart with the board’s line and the dashed outside line almost on top of each other, and a note that the outside line was moved up 1.9 hPa to sit on the board’s line

Open-Meteo gives surface pressure at ground level for the location. The board reads pressure where it sits, which might be upstairs. A board 10 m higher reads about 1.2 hPa less, so the two lines never sit on top of each other, and with a chart scaled to fit both you lose the shape of each.

The dashboard moves the outside line by the median gap between the two and says by how much. On mine that’s 1.9 hPa. Once moved, the BME280 on the board and Open-Meteo’s model track each other closely for the whole week, which was a nice check that the sensor is telling the truth.

A 24-hour PM2.5 average in Home Assistant

The firmware announces its sensors over MQTT discovery, so PM2.5 is already an entity. Home Assistant’s statistics integration can turn it into a rolling 24-hour mean:

sensor:
  - platform: statistics
    name: "PM2.5 24 hour mean"
    entity_id: sensor.enviro_001_pm2_5
    state_characteristic: mean
    max_age:
      hours: 24

Swap in your own entity ID. From there an automation on numeric_state above 15 is the obvious next step, and Mini Graph Card will chart the result.

I haven’t run this one on my own Home Assistant yet. My numbers above came from the Python script. Note that mean weights every reading equally, so it has the problem the hourly bins solve if your board’s reporting rate changes during the day.

Troubleshooting

  • No dashed lines on the particulates chart. You’re on the old image. Run docker compose pull and bring the container up again.
  • The PM10 line is missing. It only shows when the readings get near 45. That’s deliberate.
  • “No weather for … yet”. The server hasn’t fetched that location yet. If the message stays, it carries the error from the fetch.
  • The outside pressure looks wrong by a few hPa. Read the note under the chart. The line has been moved by the amount it says.
  • The script prints nothing useful. It needs readings in 18 of the last 24 hours. Give a new board a day.

One line on a chart

For a week I’d been looking at a particulates chart and nodding. Two dashed lines turned it into something I can act on: the peak on the 27th was a real one, and the scary-looking PM10 spike on the 24th wasn’t. Next I’d like to know what the house was doing at 11:24 that morning.

Or just hand this page to your agent

The script and the dashboard settings are quick for an agent to set up, as long as it asks before it touches your data.

Read https://exitcode0.net/posts/enviro-urban-pm25-who-guidelines-local-weather/ and help me compare my Enviro Urban's particulate readings with the WHO 2021 guideline levels. I run the dashboard from https://github.com/Tombo1001/enviro-urban-lowpower. Ask me where its data folder is before you read anything, and treat messages.jsonl as read-only: never edit, move or truncate it. Save pm24.py from the page, run it against my log and show me the output. Ask before you pull a new image or restart the container. If I want the weather overlay, ask me for a postcode or coordinates and tell me they'll be sent to postcodes.io and Open-Meteo before you save them. If I want the Home Assistant sensor, ask for my real PM2.5 entity ID and show me the YAML before you add it.

The page gives the agent the WHO levels, the script, the settings and what the output should look like. Only you know where your log lives, where the board is and whether you’re happy sending that location to a weather API.

Run the script after a week of data, then again after you’ve cooked a roast.

Enjoy. ✌️