| Filename | Latest commit message | Latest commit date |
|---|---|---|
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 |
||
| addon | ||
| devices | ||
| full_config | ||
| image | ||
| packages | ||
| .gitignore | ||
| airgradient-basic.bin | ||
| airgradient-basic.yaml | ||
| airgradient-one.bin | ||
| airgradient-one.yaml | ||
| airgradient-open-air-o-1ppt.bin | ||
| airgradient-open-air-o-1ppt.yaml | ||
| airgradient-open-air-o-1pst.bin | ||
| airgradient-open-air-o-1pst.yaml | ||
| airgradient-pro.bin | ||
| airgradient-pro.yaml | ||
| calibration.md | ||
| configuration.md | ||
| installation.md | ||
| LICENSE.txt | ||
| packages.md | ||
| README.md | ||
| secrets.yaml | ||
| UPSTREAM.md | ||
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; changerefreshor therefinstead.
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.
- In the ESPHome addon, open the device and choose Install → Manual download,
then flash the
.factory.binwith web.esphome.io over USB. If the board is not detected, see AirGradient's boot-mode notes. - 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.
- 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'ssensor.airgradient_study_*history belongs to a different room and is intentionally dropped. - Balcony adopts as
sensor.aq_balcony_*where it was previouslysensor.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_indicatorhelper "Mold Warning" → Study temperature + humidityscripts.yaml→ the AirGradientupdate.*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 toUPSTREAM.md; resolve withgit checkout --ours README.md.- the entity renames in
packages/sensor_s8.yaml,packages/sensor_pms5003.yamlandpackages/sensor_pms5003t.yaml— keep ours, and re-check them if upstream reworks those sensors. - the deprecation fixes in
packages/sensor_sgp41.yamlandpackages/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_fships asRESTORE_DEFAULT_ON, so a freshly flashed device shows °F. Set toRESTORE_DEFAULT_OFFin all three display packages, matching upstream's PR #131 (open since April 2025).Note that
Switch::publish_statepersists on every publish, so a device already flashed with the old default hastruewritten 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.yamlsetsRESTORE_DEFAULT_OFFdeliberately 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.