If all original sensors (PMS5003, Senseair S8, SHT4x) are connected, configuration files should be ready for use. To prevent the LED bar from flashing on boot, it is disabled by default. Once added to Home Assistant, toggle the "LED Strip" switch to enable the bar.
If some sensors are not installed, comment or remove the associated sections under packages:
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
See PMSX003 Particulate Matter Sensor — ESPHome for more information
To add your WiFi SSID and password, add your SSID and password information, per ESPHome specifications
wifi:
ssid: NachoWiFi
password: 123456123456To use IPv6, add the following to the main YAML file for your device
network:
enable_ipv6: trueBy 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
# Example
board: github://MallocArray/airgradient_esphome/packages/sensor_s8.yaml
# becomes
board: !include packages/sensor_s8.yamlRather than download an individual package and update the reference to it, you may also use the Extend option to make minor modifications without editing the packages file. This only works for items with an id: defined
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
binary_sensor:
- id: !extend config_button
pin:
number: D7
It is also possible to copy the contents of a package file and paste it directly into your YAML file. Do note that sections cannot be duplicated, so if multiple sections like interval are pasted in, they must be combined into a single entry when using this method.
Several additional packages are available in the packages folder that can be added or removed as needed. See the Packages page for more information about available options.
MQTT support has been mentioned in the AirGradient forums several times. ESPHome supports this by adding a few lines to the main yaml file. Add the relevant information for your configuration. Read more about it here: https://esphome.io/components/mqtt.html
After extensive discussion on the AirGradient forum, it may be a good idea to remove the Captive Portal package after initial configuration, as leaving it in will default to enabling the Access Point Mode if WiFi is not available, potentially allowing an external source to reconfigure the device to a new network or upload another firmware file. Can also add a password to the ap if this functionality is desired, but want to secure it.
The early DIY and Pro models were limited by ESP8266 chip that has minimal performance. The Lolin C3 Mini has the same form factor and based on the much improved ESP32-C3 chip.
- Purchase a Lolin C3 Mini, such as https://www.aliexpress.us/item/3256804553736450.html
- Replace the device in your AirGradient
- Under
packages:, replace 'airgradient_d1_mini_board.yaml' with 'airgradient_lolin-c3-mini_board.yaml' - If upgrading a Pro, change the
!extend config_buttonsection to use pin number4instead ofD7 - Install/Upgrade ESPHome on your device
Pairing ESPHome with Home Assistant opens a multitude of opportunities to create custom actions tailored to your liking.
Enabling the "Blank Page" switch will disable output on the display. It is not necessary to turn off any existing pages, and disabling all pages will result in the device rebooting
- In Home Assistant, navigate to Settings>Automations and scenes
- Click "Create Automation" button, then "Create new automation"
- When
- Add Trigger>Time>Mode>Fixed Time
- Set to your desired time to turn off the display and/or LED
- Then do
- Add Action>Device>Select your AirGradient from the ESPHome Integration
- In the Action field, select "Turn on
<Your AirGradient Name> Display Blank Page"- For the base config with only the single page display package, this will set the display to show an empty page
- If using the multi_page package, may need to add additional actions to turn off the other enabled pages
- Repeat action for "Turn Off
<Your AirGradient Name> LED Strip" (If applicable)
- Click the Save button and give it a name, such as "AirGradient Night Mode"
- When
- Repeat with a new Automation, with the actions reversed (Turn off Display Blank Page and turn on LED Strip), at the desired time with a name such as "AirGradient Night Mode Off"
