Skip to content

Commit 0fe7b6f

Browse files
authored
Release 2.0.0 (#20)
## Breaking Changes In the 2.x release of these configurations, some breaking changes are introduced * See previous 1.x release breaking changes if coming from earlier versions * Changed `name_add_mac_suffix` to false by default. This will no longer add the MAC address to the end of the device name. Assists ESPHome in properly detecting new device as Online without a static IP. Can be changed to `true` if desired. Ensure all devices have unique `name:` fields if `false`. * Changed the variable names in the `substitutions:` section to have them match the ESPHome parameters they are used with. * Changed to `config_version:` substitution name for a shorter name * Disabled Upload to AirGradient Dashboard by default, but able to flip the switch in HomeAssistant to enable if desired ## Changes * Added Display Contrast slider to dim the display * 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)) * Added optional Factory Reset switch that is disabled by default. Can be enabled in HomeAssistant and used if desired * Added optional `diagnostic.yaml` package with extra sensors about the ESP device itself, including temperature and free * Added optional `sensor_bme680.yaml` package to support the BME680 module if desired * Added `dashboard_import` to assist discovery of new devices installed with the pre-compiled .bin files
1 parent 1f6de78 commit 0fe7b6f

18 files changed

+188
-65
lines changed

README.md

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

55
## Breaking Changes
66

7-
In the 1.x release of these configurations, some breaking changes are introduced
7+
In the 2.x release of these configurations, some breaking changes are introduced
88

9-
* The devicename has been shortened from "airgradient-*" to "ag-". This matches the Friendly Name convention and results in a shorter overall devicename. You may keep yours at the longer full name if desired, but for the Open Air, the name became longer than allowed
10-
* Substitution entry for "friendly_devicename" has been renamed to "friendly_devicename" to better match it's use case instead of the legacy use
11-
* The name of the CO2 sensor has been changed to just "CO2" from the previous "Senseair S8 CO2" to shorten overall sensor name length and match other sensors that are named for what they are measuring and not the name of the sensor itself. This will result in a new sensor registered to your device in HomeAssistant and the previous one will be "Unavailable". You may need to update any graphs or other dashboard entries with the new CO2 entry
12-
* New switch added to enable/disable Automatic Background Calibration of the Senseair S8 CO2 sensor. If previously disabled, on the first install of the 1.x config, it will be enabled again. Disable after installation if desired.
9+
* See previous 1.x release breaking changes if coming from earlier versions
10+
* Changed `name_add_mac_suffix` to false by default. This will no longer add the MAC address to the end of the device name. Assists ESPHome in properly detecting new device as Online without a static IP. Can be changed to `true` if desired. Ensure all devices have unique `name:` fields if `false`.
11+
* Changed the variable names in the `substitutions:` section to have them match the ESPHome parameters they are used with.
12+
* Changed to `config_version:` substitution name for a shorter name
13+
* Disabled Upload to AirGradient Dashboard by default, but able to flip the switch in HomeAssistant to enable if desired
14+
15+
## Changes
16+
17+
* Added Display Contrast slider to dim the display
18+
* 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))
19+
* Added optional Factory Reset switch that is disabled by default. Can be enabled in HomeAssistant and used if desired
20+
* Added optional `diagnostic.yaml` package with extra sensors about the ESP device itself, including temperature and free
21+
* Added optional `sensor_bme680.yaml` package to support the BME680 module if desired
22+
* Added `dashboard_import` to assist discovery of new devices installed with the pre-compiled .bin files
1323

1424
## Features
1525

1626
Many added features can be found in HomeAssistant by going to Settings>Devices and selecting the AirGradient device. Alternatively, add `web_server:` to the config file to enable a built-in web server on the AirGradient device (No recommended for devices based on the D1 Mini ESP8266)
1727

1828
- Compact single page display by default with all relevant sensor readings
29+
- Display Contrast slider to dim the display
1930
- Enable different pages of information to be shown on the OLED display, or leave the default of a single page with all relevant information
2031

2132
![1703765819874](image/README/1703765819874.png)
@@ -52,9 +63,9 @@ Copy the .yaml file from the main folder for your model and place it in the `con
5263

5364
> Note: by default ESPHome only syncs remote repositories that the packages are referencing once per day, so if changes are made to the repository, you may not get the updated config for up to 1 day after it is published. You can remove the contents of the folder config/.esphome/packages to force it to update sooner
5465
55-
> Note: setting `add_mac_suffix: "true"` allows for multiple devices on your network at the same time and report as unique entries, but it can cause ESPHome to not detect devices as Online after installing, since ESPHome is looking for only the `devicename:` field and the actual device name has the MAC address added to the end.
66+
> Note: setting `add_mac_suffix: "true"` allows for multiple devices on your network at the same time and report as unique entries even if your `name:` field is duplicated, but it can cause ESPHome to not detect devices as Online after installing, since ESPHome is looking for only the `name:` field and the actual device name has the MAC address added to the end
5667
>
57-
> One way to resolve this is to change `add_mac_suffix: "false"` so the devicename will match exactly. If you have multiple devices, make sure to change the `devicename: `field to be unique for each device
68+
> One way to resolve this is to change `add_mac_suffix: "false"` so the device name will match exactly. If you have multiple devices, make sure to change the `name: `field to be unique for each device
5869
>
5970
> Another alternative is to add a static IP to the wifi configuration and configure ESPHome to ping the device by IP instead of hostname
6071
>
@@ -73,12 +84,6 @@ Copy the .yaml file from the main folder for your model and place it in the `con
7384
> dns1: 192.168.1.1
7485
> ```
7586
76-
#### Using local packages
77-
78-
By default, packages are referencing this GitHub repository, allowing you to do a new Install from ESPHome dashboard to get the latest modifications without downloading other files, but does require an Internet connection. If you wish to have more control over modifications or only reference local files, copy the `packages` folder to your local ESPHome folder and replace `github://MallocArray/airgradient_esphome/packages` with `!include packages`
79-
80-
> Example: `board: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml` becomes `board: !include packages/sensor_s8.yaml`
81-
8287
### ESPHome Web install
8388
8489
Install a compiled file to your device all with just a browser and USB cable, no ESPHome install required.
@@ -90,8 +95,6 @@ Save the appropriate .bin file and go to [https://web.esphome.io/](https://web.e
9095
9196
### Full YAML file
9297
93-
Configuration files reference other packages files, making for a very modular configuration, but requires looking at multiple files to see the entire picture.
94-
9598
The `full_config` folder contains a single yaml file per model that contains the full standalone configuration, created by the `esphome config` command. This adds in all of the optional parameters, so is much longer than the minimum configuration, but the single file contains all needed information to be completely independent from this repo.
9699
97100
Copy the full config file to your personal ESPhome config file and customize as desired, then install to your device.
@@ -101,7 +104,7 @@ Copy the full config file to your personal ESPhome config file and customize as
101104
If all original sensors (PMS5003, Senseair S8, SHT4x) are connected, configuration files should be ready
102105
If some sensors are not installed, comment or remove the associated sections under `packages:`
103106
104-
The PMS5003 sensor by default collects readings every second. Since this device has a limited lifespan, it is possible to extend the life by collecting readings less frequently, although this could impact the accuracy of the readings collected, since there will not be constant airflow through the device when the fan shuts down. To collect readings every 2 minutes, change the line for the pms5003 sensor to `pm_2.5: !include packages/sensor_pms5003_extended_life.yaml`
107+
The PMS5003 sensor by default collects readings every second. Since this device has a limited lifespan, it is possible to extend the life by collecting readings less frequently, although this could impact the accuracy of the readings collected, since there will not be constant airflow through the device when the fan shuts down. To collect readings every 2 minutes, change the line for the pms5003 sensor to `sensor_pms5003_extended_life.yaml`
105108
106109
> See [PMSX003 Particulate Matter Sensor — ESPHome](https://esphome.io/components/sensor/pmsx003.html#sensor-longevity) for more information
107110
@@ -113,9 +116,35 @@ wifi:
113116
password: 123456123456
114117
```
115118
116-
To modify other components, download the modify the associated packages file and modify as desired and update the packages reference to use the !include method mentioned in the Installation section. You may also use the [Extend](https://esphome.io/guides/configuration-types.html#extend) option to make minor modifications without editing the packages file.
119+
## Modification
120+
121+
#### Using local packages
117122
118-
Several packages are available in the `packages` folder that can be added or removed as needed. For example, the display package includes configuration for multiple pages of information that can be enabled or disabled, or you may wish to change to the package that has a single page to avoid extra switches in HomeAssistant or if you know you won't be using the other pages and want to save on flash memory space.
123+
By default, packages are referencing this GitHub repository, allowing you to do a new Install from ESPHome dashboard to get the latest modifications without downloading other files, but does require an Internet connection. If you wish to have more control over modifications or only reference local files, copy the `packages` folder to your local ESPHome folder in a `packages` subfolder and replace `github://MallocArray/airgradient_esphome/packages `with `!include packages`
124+
125+
```yaml
126+
# Example
127+
board: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml
128+
# becomes
129+
board: !include packages/sensor_s8.yaml
130+
```
131+
132+
#### Using Extend feature
133+
134+
Rather than download an individual package and update the reference to it, you may also use the [Extend](https://esphome.io/guides/configuration-types.html#extend) option to make minor modifications without editing the packages file. This only works for items with and `id:` defined
135+
136+
> Example: adding this to the main file for your device will change the pin number in the config_button package, while maintaining all other settings defined in the package
137+
>
138+
> ```
139+
> binary_sensor:
140+
> - id: !extend config_button
141+
> pin:
142+
> number: D7
143+
> ```
144+
145+
#### Adding other packages
146+
147+
Several additional packages are available in the `packages` folder that can be added or removed as needed. For example, the display package includes configuration for multiple pages of information that can be enabled or disabled, or you may wish to change to the package that has a single page to avoid extra switches in HomeAssistant or if you know you won't be using the other pages and want to save on flash memory space.
119148
120149
## Additional Information
121150
@@ -126,15 +155,14 @@ MQTT support has been mentioned in the AirGradient forums several times. ESPHom
126155
127156
Several more features are planned to be added to this repo
128157
129-
- [ ] Support for Open Air without CO2 sensor
158+
- [ ] Support for Open Air without CO2 sensor (Model: O-1PPT)
130159
- [ ] Explore options for disabling display/LED during certain times (May be differed to HomeAssistant Automations)
131160
- [ ] Standardize font on AirGradient Basic display to match Pro
132161
- [ ] Reduce number of fonts used in the multi_page package
133162
- [ ] 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
134163
- [ ] Poppins Light is consistent thickness, but numbers are taller than letters, giving a mismatched height
135164
- [ ] Add GitHub actions to automatically build updated .bin files as needed
136-
137-
* [ ] Add support for esp32_improv and improv_serial
138-
* [ ] [https://esphome.io/guides/creators.html](https://esphome.io/guides/creators.html "https://esphome.io/guides/creators.html")
139-
* [ ] Add support for dashboard_import and project information
140-
* [ ] [https://esphome.io/guides/creators.html](https://esphome.io/guides/creators.html "https://esphome.io/guides/creators.html")
165+
- [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)
166+
- [X] [https://esphome.io/guides/creators.html](https://esphome.io/guides/creators.html "https://esphome.io/guides/creators.html")
167+
- [X] Add support for dashboard_import and project information
168+
- [X] [https://esphome.io/guides/creators.html](https://esphome.io/guides/creators.html "https://esphome.io/guides/creators.html")

airgradient-basic.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# https://www.airgradient.com/open-airgradient/instructions/overview/
44

55
substitutions:
6-
devicename: "ag-basic"
7-
friendly_devicename: "AG Basic"
8-
ag_esphome_config_version: 1.0.0
9-
add_mac_suffix: "true" # Must have quotes around value
6+
name: "ag-basic"
7+
friendly_name: "AG Basic"
8+
config_version: 2.0.0
9+
name_add_mac_suffix: "false" # Must have quotes around value
1010

1111
# Enable Home Assistant API
1212
api: # Add encryption key as desired
@@ -17,6 +17,10 @@ wifi:
1717
# Enable fallback hotspot (captive portal) in case wifi connection fails
1818
ap:
1919

20+
dashboard_import:
21+
package_import_url: github://MallocArray/airgradient_esphome/airgradient-basic.yaml
22+
import_full_config: false
23+
2024
packages:
2125
board: github://MallocArray/airgradient_esphome/packages/airgradient_d1_mini_board.yaml
2226
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml

airgradient-one.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# https://www.airgradient.com/open-airgradient/instructions/overview/
33

44
substitutions:
5-
devicename: "ag-one"
6-
friendly_devicename: "AG One"
7-
ag_esphome_config_version: 1.0.0
8-
add_mac_suffix: "true" # Must have quotes around value
5+
name: "ag-one"
6+
friendly_name: "AG One"
7+
config_version: 2.0.0
8+
name_add_mac_suffix: "false" # Must have quotes around value
99

1010
# Enable Home Assistant API
1111
api: # Add encryption key as desired
@@ -16,6 +16,10 @@ wifi:
1616
# Enable fallback hotspot (captive portal) in case wifi connection fails
1717
ap:
1818

19+
dashboard_import:
20+
package_import_url: github://MallocArray/airgradient_esphome/airgradient-one.yaml
21+
import_full_config: false
22+
1923
packages:
2024
board: github://MallocArray/airgradient_esphome/packages/airgradient_esp32-c3_board.yaml
2125
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# https://www.airgradient.com/open-airgradient/instructions/overview/
44

55
substitutions:
6-
devicename: "ag-open-air-o-1pst"
7-
friendly_devicename: "AG Open Air O-1PST"
8-
ag_esphome_config_version: 1.0.0
9-
add_mac_suffix: "true" # Must have quotes around value
6+
name: "ag-open-air-o-1pst"
7+
friendly_name: "AG Open Air O-1PST"
8+
config_version: 2.0.0
9+
name_add_mac_suffix: "false" # Must have quotes around value
1010

1111
# Enable Home Assistant API
1212
api: # Add encryption key as desired
@@ -17,6 +17,10 @@ wifi:
1717
# Enable fallback hotspot (captive portal) in case wifi connection fails
1818
ap:
1919

20+
dashboard_import:
21+
package_import_url: github://MallocArray/airgradient_esphome/airgradient-open-air-o-1pst.yaml
22+
import_full_config: false
23+
2024
packages:
2125
board: github://MallocArray/airgradient_esphome/packages/airgradient_esp32-c3_board.yaml
2226
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003t.yaml

airgradient-pro.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# https://www.airgradient.com/open-airgradient/instructions/overview/
33

44
substitutions:
5-
devicename: "ag-pro"
6-
friendly_devicename: "AG Pro"
7-
ag_esphome_config_version: 1.0.0
8-
add_mac_suffix: "true" # Must have quotes around value
5+
name: "ag-pro"
6+
friendly_name: "AG Pro"
7+
config_version: 2.0.0
8+
name_add_mac_suffix: "false" # Must have quotes around value
99

1010
# Enable Home Assistant API
1111
api:
@@ -16,6 +16,10 @@ wifi:
1616
# Enable fallback hotspot (captive portal) in case wifi connection fails
1717
ap:
1818

19+
dashboard_import:
20+
package_import_url: github://MallocArray/airgradient_esphome/airgradient-pro.yaml
21+
import_full_config: false
22+
1923
packages:
2024
board: github://MallocArray/airgradient_esphome/packages/airgradient_d1_mini_board.yaml
2125
pm_2.5: github://MallocArray/airgradient_esphome/packages/sensor_pms5003.yaml

packages/airgradient_api_d1_mini.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ switch:
3030
- platform: template
3131
name: "Upload to AirGradient Dashboard"
3232
id: upload_airgradient
33-
restore_mode: RESTORE_DEFAULT_ON
33+
restore_mode: RESTORE_DEFAULT_OFF
3434
optimistic: True
3535

3636
esphome:

packages/airgradient_api_d1_mini_no_sgp41.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ switch:
2828
- platform: template
2929
name: "Upload to AirGradient Dashboard"
3030
id: upload_airgradient
31-
restore_mode: RESTORE_DEFAULT_ON
31+
restore_mode: RESTORE_DEFAULT_OFF
3232
optimistic: True
3333

3434
esphome:

packages/airgradient_api_esp32-c3.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ switch:
3030
- platform: template
3131
name: "Upload to AirGradient Dashboard"
3232
id: upload_airgradient
33-
restore_mode: RESTORE_DEFAULT_ON
33+
restore_mode: RESTORE_DEFAULT_OFF
3434
optimistic: True
3535

3636
esphome:

packages/airgradient_d1_mini_board.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

22
esphome:
3-
name: "${devicename}"
4-
friendly_name: "${friendly_devicename}"
5-
name_add_mac_suffix: ${add_mac_suffix} # Set to false if you don't want part of the MAC address in the name
3+
name: "${name}"
4+
friendly_name: "${friendly_name}"
5+
name_add_mac_suffix: ${name_add_mac_suffix} # Set to false if you don't want part of the MAC address in the name
6+
67
project:
78
name: mallocarray.airgradient
8-
version: "$ag_esphome_config_version"
9-
min_version: 2023.7.0
9+
version: "$config_version"
10+
min_version: 2023.12.0
1011

1112
esp8266:
1213
board: d1_mini
@@ -41,3 +42,9 @@ i2c:
4142
sda: D2
4243
scl: D1
4344
frequency: 400kHz # 400kHz eliminates warnings about components taking a long time other than SGP40 component: https://github.com/esphome/issues/issues/4717
45+
46+
button:
47+
- platform: factory_reset
48+
disabled_by_default: true
49+
name: "Factory Reset ESP"
50+
id: factory_reset_all

packages/airgradient_esp32-c3_board.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11

22
esphome:
3-
name: "${devicename}"
4-
friendly_name: "${friendly_devicename}"
5-
name_add_mac_suffix: ${add_mac_suffix} # Set to false if you don't want part of the MAC address in the name
3+
name: "${name}"
4+
friendly_name: "${friendly_name}"
5+
name_add_mac_suffix: ${name_add_mac_suffix} # Set to false if you don't want part of the MAC address in the name
6+
67
project:
78
name: mallocarray.airgradient
8-
version: "$ag_esphome_config_version"
9-
min_version: 2023.7.0
9+
version: "$config_version"
10+
11+
min_version: 2023.12.0
1012

1113
esp32:
1214
board: esp32-c3-devkitm-1
1315

16+
# esp32_improv: # Uses around 30% of available flash space due to loading BLE stack
17+
# authorizer: none
18+
1419
# Enable logging
1520
# https://esphome.io/components/logger.html
1621
logger:
@@ -41,3 +46,9 @@ i2c:
4146
sda: GPIO7 # Pin 21
4247
scl: GPIO6 # Pin 20
4348
frequency: 400kHz # 400kHz eliminates warnings about components taking a long time other than SGP40 component: https://github.com/esphome/issues/issues/4717
49+
50+
button:
51+
- platform: factory_reset
52+
disabled_by_default: true
53+
name: "Factory Reset ESP"
54+
id: factory_reset_all

0 commit comments

Comments
 (0)