Skip to content

Commit 6245a7a

Browse files
committed
Release 4.0.0
1 parent 67bc49d commit 6245a7a

26 files changed

+500
-237
lines changed

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,23 @@ ESPHome yaml files for AirGradient devices to maintain the research and accuracy
44

55
## Breaking Changes
66

7-
Due to renaming of the Automatic Background Calibration switch to the proper name of Automatic Baseline Correction, this switch will default to being enabled, even if previously you had disabled it. After installing, disable again if desired
7+
* Remove substitution line such as `config_version: 2.0.5` from the main file, as this has been moved into the board package file
8+
* Updated to 4.0.0 versions, skipping 3.x to avoid confusion with current AirGradient official firmware
89

910
## Changes
1011

11-
* Added Display Contrast slider to dim the display
12-
* Added device_class to the PMSx005 sensors to have them properly reflect in the HomeKit integration if supported ([Forum Link](https://forum.airgradient.com/t/airgradient-one-customized-mallocarray-esphome-display/1328/7?u=mallocarray))
13-
* Added optional Factory Reset switch that is disabled by default. Can be enabled in HomeAssistant and used if desired
14-
* LED combo package. Left 5 LEDs reflect CO2 levels, middle 5 LEDs reflect PM2.5 levels, far right indicates VOC. (Same as display)
15-
* LED bar configs feature a "LED Fade" parameter that controls the percentage that the LED bar dims out from the center
16-
![1715467068556](image/README/1715467068556.png)
17-
* CO2 package supports optional substitution `co2_offset` to offset reported readings by a set amount. Useful if sensor is known to be off by a certain amount, or if wanting to override default calibration of 400 ppm
12+
* Support for ESPHome 2024.6 and later
13+
* Added extended timeout for API upload on ONE and OpenAir models to reduce reboots
14+
* Applied correction algorithms for PM2.5 provided by AirGradient
15+
* https://www.airgradient.com/documentation/correction-algorithms/
16+
* Updated API upload to follow current structure including both raw and corrected values
17+
* Moved config_version substitution into the board package so it can be updated without manual change to main config file. Please remove the line starting with `config_version:` from your personal files
18+
* Split captive portal config to a separate package. Can be removed if not using the portal or if defining wifi networks in your config file, which results in a small memory savings
19+
* Removed safe_mode package by default. Very few use cases for it
20+
* Added commented out packages for extended_life configs to make it easier to enable if desired
21+
* Added commented out package for SHT30 temp sensor in AG Pro file to make it easier to switch to if desired
22+
* Added new sensor options for raw values for PM2.5, temp, and humidity in some device configurations, and added AirGradient provided correction algorithms to the standard sensors
23+
* AG DIY Basic display config changed to same font as other models, downloading from gfonts instead of using local file
1824

1925
## Features
2026

@@ -48,7 +54,7 @@ Many added features can be found in HomeAssistant by going to Settings>Devices a
4854

4955
- Short press (Less than 1 second) - Toggle between F and C on display
5056
- Long press (More than 1 second, less than 5) - Trigger manual CO2 calibration
51-
- Leverage automations in HomeAssistant to turn on the "Blank" page and turn off all other pages to effectively disable the display output. Could also turn off the LED strip or set Brightness to 0 to eliminate output while still collecting sensor data
57+
- Leverage automation in HomeAssistant to turn on the "Blank" page and turn off all other pages to effectively disable the display output. Could also turn off the LED strip or set Brightness to 0 to eliminate output while still collecting sensor data
5258

5359
## Installation
5460

@@ -162,14 +168,5 @@ MQTT support has been mentioned in the AirGradient forums several times. ESPHom
162168
163169
Several more features are planned to be added to this repo
164170
165-
- [X] Support for Open Air without CO2 sensor (Model: O-1PPT)
166-
- [ ] Explore options for disabling display/LED during certain times (May be differed to HomeAssistant Automations)
167-
- [ ] Standardize font on AirGradient Basic display to match Pro
168-
- [X] Reduce number of fonts used in the multi_page package
169-
- [X] Open Sans displays a consistent height, but some characters, such as F and 0 are mismatched, the left side is double line thick while right is single line
170-
- [X] Poppins Light is consistent thickness, but numbers are taller than letters, giving a mismatched height
171-
- [ ] Add GitHub actions to automatically build updated .bin files as needed
172-
- [X] Add support for esp32_improv and improv_serial (improv_serial not supported with this board and used pins. esp32_improv uses 30% of available flash memory and is nearly full)
173-
- [X] [https://esphome.io/guides/creators.html](https://esphome.io/guides/creators.html "https://esphome.io/guides/creators.html")
174-
- [X] Add support for dashboard_import and project information
175-
- [X] [https://esphome.io/guides/creators.html](https://esphome.io/guides/creators.html "https://esphome.io/guides/creators.html")
171+
- [ ] Explore options for disabling display/LED during certain times (May be differed to HomeAssistant Automation)
172+
- [X] Standardize font on AirGradient Basic display to match Pro

airgradient-basic.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
substitutions:
66
name: "ag-basic"
77
friendly_name: "AG Basic"
8-
config_version: 2.0.5
98
name_add_mac_suffix: "false" # Must have quotes around value
109

1110
# Enable Home Assistant API
@@ -16,20 +15,19 @@ ota: # Add password as desired
1615
# password:
1716

1817
wifi:
19-
# Enable fallback hotspot (captive portal) in case wifi connection fails
20-
ap:
2118

2219
dashboard_import:
2320
package_import_url: github://MallocArray/airgradient_esphome/airgradient-basic.yaml
2421
import_full_config: false
2522

2623
packages:
2724
board: github://MallocArray/airgradient_esphome/packages/airgradient_d1_mini_board.yaml
25+
captive_portal: !include github://MallocArray/airgradient_esphome/packages/captive_portal.yaml
2826
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml
2927
co2: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml
28+
# temp_humidity: github://MallocArray/airgradient_esphome/packages/sensor_sht40.yaml
3029
temp_humidity: github://MallocArray/airgradient_esphome/packages/sensor_sht30.yaml
3130
display: github://MallocArray/airgradient_esphome/packages/display_ssd1306.yaml
3231
airgradient_api: github://MallocArray/airgradient_esphome/packages/airgradient_api_d1_mini_no_sgp41.yaml
3332
wifi: github://MallocArray/airgradient_esphome/packages/sensor_wifi.yaml
3433
uptime: github://MallocArray/airgradient_esphome/packages/sensor_uptime.yaml
35-
safe_mode: github://MallocArray/airgradient_esphome/packages/switch_safe_mode.yaml

airgradient-one.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
substitutions:
55
name: "ag-one"
66
friendly_name: "AG One"
7-
config_version: 2.0.5
87
name_add_mac_suffix: "false" # Must have quotes around value
98

109
# Enable Home Assistant API
@@ -15,15 +14,14 @@ ota: # Add password as desired
1514
# password:
1615

1716
wifi:
18-
# Enable fallback hotspot (captive portal) in case wifi connection fails
19-
ap:
2017

2118
dashboard_import:
2219
package_import_url: github://MallocArray/airgradient_esphome/airgradient-one.yaml
2320
import_full_config: false
2421

2522
packages:
2623
board: github://MallocArray/airgradient_esphome/packages/airgradient_esp32-c3_board.yaml
24+
captive_portal: !include github://MallocArray/airgradient_esphome/packages/captive_portal.yaml
2725
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml
2826
co2: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml
2927
temp_humidity: github://MallocArray/airgradient_esphome/packages/sensor_sht40.yaml
@@ -36,7 +34,6 @@ packages:
3634
config_button: github://MallocArray/airgradient_esphome/packages/config_button.yaml
3735
wifi: github://MallocArray/airgradient_esphome/packages/sensor_wifi.yaml
3836
uptime: github://MallocArray/airgradient_esphome/packages/sensor_uptime.yaml
39-
safe_mode: github://MallocArray/airgradient_esphome/packages/switch_safe_mode.yaml
4037

4138
binary_sensor:
4239
- id: !extend config_button

airgradient-open-air-o-1ppt.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
substitutions:
66
name: "ag-open-air-o-1ppt"
77
friendly_name: "AG Open Air O-1PPT"
8-
config_version: 2.0.5
98
name_add_mac_suffix: "false" # Must have quotes around value
109

1110
# Enable Home Assistant API
@@ -16,20 +15,20 @@ ota: # Add password as desired
1615
# password:
1716

1817
wifi:
19-
# Enable fallback hotspot (captive portal) in case wifi connection fails
20-
ap:
2118

2219
dashboard_import:
2320
package_import_url: github://MallocArray/airgradient_esphome/airgradient-open-air-o-1ppt.yaml
2421
import_full_config: false
2522

2623
packages:
2724
board: github://MallocArray/airgradient_esphome/packages/airgradient_esp32-c3_board.yaml
25+
captive_portal: !include github://MallocArray/airgradient_esphome/packages/captive_portal.yaml
2826
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t.yaml
27+
# pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t_extended_life.yaml
2928
pm_2.5_2: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t_2.yaml
29+
# pm_2.5_2: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t_2extended_life.yaml
3030
tvoc: github://MallocArray/airgradient_esphome/packages/sensor_sgp41.yaml
3131
airgradient_api: github://MallocArray/airgradient_esphome/packages/airgradient_api_esp32-c3_dual_pms5003t.yaml
3232
hardware_watchdog: github://MallocArray/airgradient_esphome/packages/watchdog.yaml
3333
wifi: github://MallocArray/airgradient_esphome/packages/sensor_wifi.yaml
3434
uptime: github://MallocArray/airgradient_esphome/packages/sensor_uptime.yaml
35-
safe_mode: github://MallocArray/airgradient_esphome/packages/switch_safe_mode.yaml

airgradient-open-air-o-1pst.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
substitutions:
66
name: "ag-open-air-o-1pst"
77
friendly_name: "AG Open Air O-1PST"
8-
config_version: 2.0.5
98
name_add_mac_suffix: "false" # Must have quotes around value
109

1110
# Enable Home Assistant API
@@ -16,20 +15,19 @@ ota: # Add password as desired
1615
# password:
1716

1817
wifi:
19-
# Enable fallback hotspot (captive portal) in case wifi connection fails
20-
ap:
2118

2219
dashboard_import:
2320
package_import_url: github://MallocArray/airgradient_esphome/airgradient-open-air-o-1pst.yaml
2421
import_full_config: false
2522

2623
packages:
2724
board: github://MallocArray/airgradient_esphome/packages/airgradient_esp32-c3_board.yaml
25+
captive_portal: !include github://MallocArray/airgradient_esphome/packages/captive_portal.yaml
2826
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t.yaml
27+
# pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t_extended_life.yaml
2928
co2: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml
3029
tvoc: github://MallocArray/airgradient_esphome/packages/sensor_sgp41.yaml
3130
airgradient_api: github://MallocArray/airgradient_esphome/packages/airgradient_api_esp32-c3.yaml
3231
hardware_watchdog: github://MallocArray/airgradient_esphome/packages/watchdog.yaml
3332
wifi: github://MallocArray/airgradient_esphome/packages/sensor_wifi.yaml
3433
uptime: github://MallocArray/airgradient_esphome/packages/sensor_uptime.yaml
35-
safe_mode: github://MallocArray/airgradient_esphome/packages/switch_safe_mode.yaml

airgradient-pro.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
substitutions:
55
name: "ag-pro"
66
friendly_name: "AG Pro"
7-
config_version: 2.0.5
87
name_add_mac_suffix: "false" # Must have quotes around value
98

109
# Enable Home Assistant API
@@ -15,25 +14,24 @@ ota: # Add password as desired
1514
# password:
1615

1716
wifi:
18-
# Enable fallback hotspot (captive portal) in case wifi connection fails
19-
ap:
2017

2118
dashboard_import:
2219
package_import_url: github://MallocArray/airgradient_esphome/airgradient-pro.yaml
2320
import_full_config: false
2421

2522
packages:
2623
board: github://MallocArray/airgradient_esphome/packages/airgradient_d1_mini_board.yaml
24+
captive_portal: !include github://MallocArray/airgradient_esphome/packages/captive_portal.yaml
2725
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml
2826
co2: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml
2927
temp_humidity: github://MallocArray/airgradient_esphome/packages/sensor_sht40.yaml
28+
# temp_humidity: github://MallocArray/airgradient_esphome/packages/sensor_sht30.yaml
3029
tvoc: github://MallocArray/airgradient_esphome/packages/sensor_sgp41.yaml
3130
display: github://MallocArray/airgradient_esphome/packages/display_sh1106_single_page.yaml
3231
airgradient_api: github://MallocArray/airgradient_esphome/packages/airgradient_api_d1_mini.yaml
3332
config_button: github://MallocArray/airgradient_esphome/packages/config_button.yaml
3433
wifi: github://MallocArray/airgradient_esphome/packages/sensor_wifi.yaml
3534
uptime: github://MallocArray/airgradient_esphome/packages/sensor_uptime.yaml
36-
safe_mode: github://MallocArray/airgradient_esphome/packages/switch_safe_mode.yaml
3735

3836
binary_sensor:
3937
- id: !extend config_button

full_config/ag-open-air-o-1ppt.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ sensor:
190190
id: temp
191191
filters:
192192
- lambda: !lambda |-
193+
// Remove line with (x > 6000) once the negative number issue fix is merged in https://github.com/esphome/issues/issues/3814
194+
if (x > 6000) return ((x - 6553.6) * 1.327) - 6.738;
193195
if (x < 10.0) return (x * 1.327) - 6.738;
194196
return (x * 1.181) - 5.113;
195197
- sliding_window_moving_average:
@@ -324,6 +326,8 @@ sensor:
324326
id: temp_2
325327
filters:
326328
- lambda: !lambda |-
329+
// Remove line with (x > 6000) once the negative number issue fix is merged in https://github.com/esphome/issues/issues/3814
330+
if (x > 6000) return ((x - 6553.6) * 1.327) - 6.738;
327331
if (x < 10.0) return (x * 1.327) - 6.738;
328332
return (x * 1.181) - 5.113;
329333
- sliding_window_moving_average:

full_config/ag-open-air-o-1pst.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ sensor:
209209
id: temp
210210
filters:
211211
- lambda: !lambda |-
212+
// Remove line with (x > 6000) once the negative number issue fix is merged in https://github.com/esphome/issues/issues/3814
213+
if (x > 6000) return ((x - 6553.6) * 1.327) - 6.738;
212214
if (x < 10.0) return (x * 1.327) - 6.738;
213215
return (x * 1.181) - 5.113;
214216
- sliding_window_moving_average:

packages.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ Board configuration for devices based on the D1 Mini chip (AG Basic and AG Pro)
2626

2727
Board configuration for devices based on the ESP32-C3 chip (AG ONE and OpenAir)
2828

29+
## button_factory_reset.yaml
30+
31+
Enables a button to reset device to factory resets, which erases all nvram and erases all stored preferences.
32+
33+
Useful if warning messages about being unable to save preferences appear
34+
35+
## captive_portal.yaml
36+
37+
Configures the device to provide a captive portal to create a hotspot if wifi is not connected, so it can be connected to a new wifi network without reconfiguring the config file
38+
2939
## config_button.yaml
3040

3141
Enables the configuration button on the AirGradient device. Default configuration is for devices based on ESP32-C3 chip, but additional configuration can be added to change the pin to support D1 Mini if the device has a physical button installed (Already part of the config file for AG Pro v4.2)
@@ -197,10 +207,20 @@ Configures a Plantower PMS5003T sensor. Reports PM 2.5, Temperature, and Humidi
197207

198208
Also applies a compensation algorithm from AirGradient to correct temperature and humidity readings when used inside of the Open Air enclosure
199209

210+
## sensor_pms5003_uncorrected.yaml
211+
212+
Configures a Plantower PMS5003 sensor using raw values from the sensor
213+
214+
Reports PM 2.5, PM 10, PM 1.0, PM 0.3, and Air Quality Index based on the current readings.
215+
200216
## sensor_pms5003.yaml
201217

202218
Configures a Plantower PMS5003 sensor.
203219

220+
Applies correction algorithms provided by AirGradient
221+
222+
https://www.airgradient.com/documentation/correction-algorithms/
223+
204224
Reports PM 2.5, PM 10, PM 1.0, PM 0.3, and Air Quality Index based on the current readings.
205225

206226
## sensor_s8.yaml
@@ -224,6 +244,15 @@ Configures a Sensirion SGP41 sensor.
224244

225245
Reports VOC and NOx Index values.
226246

247+
Now supports modifying VOC and NOx learning time offset hours by adding the substitutions
248+
249+
```yaml
250+
substitutions:
251+
# 12, 60, 120, 360, 720 are suggested values from AirGradient (range 1..1000)
252+
voc_learning_time_offset_hours: '12'
253+
nox_learning_time_offset_hours: '12'
254+
```
255+
227256
## sensor_sht30.yaml
228257

229258
Configures a Sensirion SHT30 sensor

packages/airgradient_api_d1_mini.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ interval:
2020
pm02: !lambda return to_string(id(pm_2_5).state);
2121
pm10: !lambda return to_string(id(pm_10_0).state);
2222
pm003Count: !lambda return to_string(id(pm_0_3um).state);
23-
atmp: !lambda return to_string(id(temp).state);
24-
rhum: !lambda return to_string(id(humidity).state);
23+
atmp: !lambda return to_string(id(temp_raw).state);
24+
atmpCompensated: !lambda return to_string(id(temp).state);
25+
rhum: !lambda return to_string(id(humidity_raw).state);
26+
rhumCompensated: !lambda return to_string(id(humidity).state);
2527
tvocIndex: !lambda return to_string(id(voc).state);
2628
noxIndex: !lambda return to_string(id(nox).state);
2729
# Uptime in minutes as the boot value

0 commit comments

Comments
 (0)