No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brian Clemens 25247308f3
Celsius by default, overnight OLED blanking, NowCast, reset button
display_in_f ships as RESTORE_DEFAULT_ON, so a fresh flash shows
Fahrenheit. Flip all three display packages to RESTORE_DEFAULT_OFF, the
same change as upstream PR #131, open since April 2025.

The Bedroom OLED now blanks 22:00-07:00 by driving the display package's
own display_blank_page switch, so the Home Assistant switch stays in
sync and the sensors keep reporting. Time comes from the Home Assistant
connection rather than an SNTP client, to keep it small on the ESP8266.
A once-per-boot sync handler fixes up the persisted switch state after a
daytime reboot without stomping on a manual override later.

Balcony gets EPA NowCast and AQI category sensors; those are outdoor-air
metrics so the indoor units do not.

All three get the factory reset button, which is the escape hatch for
persisted switch state like the Fahrenheit default above.

Also record in calibration.md that no batch-specific PM2.5 correction
was configured under the stock firmware, read from the Open Air's local
config API before reflashing, so there is nothing to migrate.

Assisted-by: claude-opus-5
2026-11-07 10:53:37 +09:00
addon Fetch remote packages on every build 2026-11-06 00:13:25 +09:00
devices Celsius by default, overnight OLED blanking, NowCast, reset button 2026-11-07 10:53:37 +09:00
full_config 5.3.6 full configs 2026-06-01 14:23:12 -05:00
image Rearrange README into separate files 2025-03-20 21:21:15 -05:00
packages Celsius by default, overnight OLED blanking, NowCast, reset button 2026-11-07 10:53:37 +09:00
.gitignore Add packages files for upcoming modification 2024-01-01 10:08:59 -06:00
airgradient-basic.bin 5.3.5 full config and bin files 2026-05-27 13:39:36 -05:00
airgradient-basic.yaml WPA2 Minimum 2026-05-26 18:43:13 -05:00
airgradient-one.bin 5.3.5 full config and bin files 2026-05-27 13:39:36 -05:00
airgradient-one.yaml WPA2 Minimum 2026-05-26 18:43:13 -05:00
airgradient-open-air-o-1ppt.bin 5.3.5 full config and bin files 2026-05-27 13:39:36 -05:00
airgradient-open-air-o-1ppt.yaml WPA2 Minimum 2026-05-26 18:43:13 -05:00
airgradient-open-air-o-1pst.bin 5.3.5 full config and bin files 2026-05-27 13:39:36 -05:00
airgradient-open-air-o-1pst.yaml WPA2 Minimum 2026-05-26 18:43:13 -05:00
airgradient-pro.bin 5.3.5 full config and bin files 2026-05-27 13:39:36 -05:00
airgradient-pro.yaml WPA2 Minimum 2026-05-26 18:43:13 -05:00
calibration.md Celsius by default, overnight OLED blanking, NowCast, reset button 2026-11-07 10:53:37 +09:00
configuration.md Fix crash when all page switches are disabled 2026-05-14 20:15:42 -07:00
installation.md Rearrange README into separate files 2025-03-20 21:21:15 -05:00
LICENSE.txt Add License 2023-10-13 19:59:40 -05:00
packages.md Clarify and add information about Lolin C3 Mini 2025-10-18 14:33:26 -05:00
README.md Celsius by default, overnight OLED blanking, NowCast, reset button 2026-11-07 10:53:37 +09:00
secrets.yaml Initial Commit 2021-11-14 20:23:15 -06:00
UPSTREAM.md Add tiuxo device configs and addon stubs 2026-11-05 22:06:27 +09:00

airgradient_esphome (tiuxo)

ESPHome firmware for the AirGradient monitors at tiuxo.com, replacing AirGradient's stock firmware and the Home Assistant airgradient integration. All data stays local — the airgradient_api_* packages that POST to hw.airgradient.com are deliberately not used by any device here.

This is a fork of MallocArray/airgradient_esphome; upstream's own documentation is preserved as UPSTREAM.md, installation.md, configuration.md, calibration.md and packages.md.

Devices

Per-device extras: the Bedroom blanks its OLED overnight, and the Balcony gets EPA NowCast/AQI. See calibration.md for why no batch-specific PM2.5 correction is set.

Room Model MCU Static IP MAC Config
Study AirGradient ONE I-9PSL (board v9) ESP32-C3 192.168.10.61 d8:3b:da:1e:0e:74 devices/aq-study.yaml
Bedroom AirGradient DIY Pro I-1DIY D1 Mini ESP8266 192.168.10.60 84:f3:eb:4b:c4:62 devices/aq-bedroom.yaml
Balcony AirGradient Open Air O-1PST ESP32-C3 192.168.10.62 34:b7:da:9f:a6:cc devices/aq-balcony.yaml

All three sit on the IoT VLAN (192.168.10.0/24); Home Assistant is on 192.168.30.30. The addresses are set statically in the addon stubs rather than by DHCP reservation, and sit below .100 so they cannot collide with a lease. They are new: the Study was previously on .100 and the Balcony on .122.

Layout

Path Contents
devices/ One full per-device config. No secrets, no network settings.
addon/ Reference copies of the thin stubs that live in /config/esphome/ on the HA addon.
packages/ Upstream's feature packages. Vendored unchanged except for the entity renames below.
full_config/, *.bin, airgradient-*.yaml Upstream artifacts, kept so git merge upstream/main stays clean.

How it fits together

The ESPHome Device Builder addon holds a ~30 line stub per device. The stub supplies the things that must not be in git (wifi credentials, API encryption key, OTA password) plus the static IP, and pulls the rest from this repo as a remote package:

packages:
  device:
    url: https://git.tiuxo.com/brian/airgradient_esphome
    ref: main
    files: [devices/aq-study.yaml]
    refresh: always

devices/aq-study.yaml then pulls in packages/ with relative !includes, which resolve inside the repo clone ESPHome caches for that url and ref.

refresh: always so a push here is picked up by the next build. It costs a fetch per build, which is nothing against a forgejo on the same LAN, and avoids chasing phantom stale-config problems. The tradeoff is that builds need git.tiuxo.com reachable.

Do not go looking for that cache under /config/esphome/.esphome/ — the Device Builder addon keeps it in its own storage, which the Terminal & SSH addon cannot see. There is nothing to delete by hand; change refresh or the ref instead.

Secrets live only in /config/esphome/secrets.yaml:

wifi_ssid, wifi_password
aq_study_api_key
aq_bedroom_api_key
aq_balcony_api_key

One key per device: the stubs give ota: a bare encryption: block, which inherits the API encryption key, so there is no separate OTA password. Note that this means anyone holding the API key — Home Assistant included — can also push firmware.

Flashing

AirGradient's stock firmware cannot OTA into ESPHome, and upstream ≥ 5.0.0 repartitions the ESP32-C3 for esp-idf, so each device needs one USB flash. Everything after that is OTA from the addon.

  1. In the ESPHome addon, open the device and choose Install → Manual download, then flash the .factory.bin with web.esphome.io over USB. If the board is not detected, see AirGradient's boot-mode notes.
  2. Unplug power fully for 5–10 seconds afterwards. A software reset does not clear all sensor states and readings can come up wrong without it.
  3. Adopt in Home Assistant, then rename entity IDs to the pre-migration slugs so long-term statistics reattach (see below).

Home Assistant entity IDs

Delete the old config entry before adopting the ESPHome device, otherwise the new entities land on _2 suffixes and their history does not reattach.

Upstream names five sensors differently from the airgradient integration, which would have changed their entity IDs and orphaned their long-term statistics. Rather than rename them by hand in Home Assistant, packages/sensor_s8.yaml, packages/sensor_pms5003.yaml and packages/sensor_pms5003t.yaml are patched to use the integration's names:

upstream here entity ID
CO2 Carbon dioxide sensor.<device>_carbon_dioxide
PM 1.0 PM1 sensor.<device>_pm1
PM 2.5 PM2.5 sensor.<device>_pm2_5
PM 10.0 PM10 sensor.<device>_pm10
PM 0.3 PM0.3 sensor.<device>_pm0_3

Temperature, Humidity, VOC Index and NOx Index already lined up.

(This is patched in the packages rather than overridden per device because !extend cannot reach an ID nested inside a platform block, which is where co2, pm_1_0, pm_10_0 and pm_0_3um are declared.)

With that in place:

  • Study adopts straight onto its existing sensor.aq_study_* IDs — nothing to rename, dashboard cards and statistics carry over.
  • Bedroom is new (sensor.aq_bedroom_*); its predecessor's sensor.airgradient_study_* history belongs to a different room and is intentionally dropped.
  • Balcony adopts as sensor.aq_balcony_* where it was previously sensor.balcony_*. To keep its statistics, rename these nine by hand after adoption: temperature, humidity, carbon_dioxide, pm1, pm2_5, pm10, pm0_3, voc_index, nox_index.

Other things in HA that point at these sensors:

  • mold_indicator helper "Mold Warning" → Study temperature + humidity
  • scripts.yaml → the AirGradient update.* entity
  • the default dashboard → five sensor.aq_study_* cards

Tracking upstream

git fetch upstream
git merge upstream/main

Deliberate divergences that can conflict:

  • README.md — upstream's was moved to UPSTREAM.md; resolve with git checkout --ours README.md.
  • the entity renames in packages/sensor_s8.yaml, packages/sensor_pms5003.yaml and packages/sensor_pms5003t.yaml — keep ours, and re-check them if upstream reworks those sensors.
  • the deprecation fixes in packages/sensor_sgp41.yaml and packages/led.yaml — drop ours if upstream lands the same fix.

After merging, run esphome config on each device before flashing anything.

Deprecations

esphome config builds clean. Upstream's packages emitted three deprecation warnings, all fixed here ahead of the removals, since upstream has been quiet since June 2026 and their tracking issue (#207) is still open:

warning fix removed in
[sgp4x] 'voc'/'nox' is deprecated voc:/nox: → voc_index:/nox_index: in packages/sensor_sgp41.yaml 2027.2.0
[esp32_rmt_led_strip] 'rgb_order' is deprecated rgb_order: GRB → channel_colors: GRB in packages/led.yaml 2027.3.0
'ota' password wastes significant flash and RAM password: → bare encryption: in the addon stubs n/a

The sgp4x change is a config key rename only (cv.rename_key); the name: and id: underneath are untouched, so no entity IDs move.

Other patches to upstream's packages

  • Celsius by default — display_in_f ships as RESTORE_DEFAULT_ON, so a freshly flashed device shows °F. Set to RESTORE_DEFAULT_OFF in all three display packages, matching upstream's PR #131 (open since April 2025).

    Note that Switch::publish_state persists on every publish, so a device already flashed with the old default has true written to flash and will keep showing °F regardless of this change. Toggle the switch off once in Home Assistant, or use the factory reset button.

Gotchas after flashing

  • The LED bar is off on the Study until you enable "LED Strip" in Home Assistant — led.yaml sets RESTORE_DEFAULT_OFF deliberately so it does not flash on boot.
  • SenseAir ABC is on by default, recalibrating to 400 ppm roughly weekly. Correct for the Balcony; for a bedroom that is often shut it can drift. The switch and a manual calibration button are both exposed.