forked from ajfriesen/ESPHome-AirGradient
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial AirGradient Open Air config
- Loading branch information
1 parent
ea01444
commit 206c661
Showing
1 changed file
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
# Airgradient Pro presoldered edition | ||
# D1 mini v4.0.0 with usb c port | ||
substitutions: | ||
id: "1" | ||
devicename: "airgradient-open-air" | ||
upper_devicename: "AirGradient Open Air" | ||
|
||
esphome: | ||
name: "${devicename}-${id}" | ||
friendly_name: "${upper_devicename} ${id}" | ||
# Automatically add the mac address to the name | ||
# so you can use a single firmware for all devices | ||
# name_add_mac_suffix: true | ||
platform: esp32 | ||
board: esp32-c3-devkitm-1 | ||
|
||
# Enable logging | ||
logger: | ||
baud_rate: 0 | ||
level: INFO | ||
|
||
# Enable Home Assistant API | ||
api: | ||
|
||
ota: | ||
password: !secret ota_password | ||
|
||
wifi: | ||
networks: | ||
- ssid: !secret wifi_ssid | ||
password: !secret wifi_password | ||
reboot_timeout: 15min | ||
|
||
# Enable fallback hotspot (captive portal) in case wifi connection fails | ||
ap: | ||
ssid: "${upper_devicename} Hotspot" | ||
password: !secret fallback_ssid_password | ||
|
||
web_server: | ||
port: 80 | ||
include_internal: true | ||
|
||
# captive_portal: | ||
|
||
# Create a switch for safe_mode in order to flash the device | ||
# Solution from this thread: | ||
# https://community.home-assistant.io/t/esphome-flashing-over-wifi-does-not-work/357352/1 | ||
switch: | ||
- platform: safe_mode | ||
name: "Flash Mode (Safe Mode)" | ||
icon: "mdi:cellphone-arrow-down" | ||
|
||
button: | ||
- platform: restart | ||
name: "Restart" | ||
disabled_by_default: true | ||
id: button_restart | ||
|
||
output: | ||
- platform: gpio | ||
id: watchdog | ||
pin: GPIO2 | ||
|
||
# Reset hardware watchdog every 5 minutes | ||
interval: | ||
- interval: 5min | ||
then: | ||
- output.turn_on: watchdog | ||
- delay: 20ms | ||
- output.turn_off: watchdog | ||
|
||
light: | ||
- platform: status_led | ||
name: "Status LED" | ||
pin: GPIO10 | ||
|
||
binary_sensor: | ||
- platform: gpio | ||
name: "Button" | ||
pin: | ||
number: GPIO9 | ||
inverted: true | ||
mode: | ||
input: true | ||
pullup: true | ||
on_click: | ||
min_length: 5s | ||
then: | ||
- button.press: button_restart | ||
|
||
i2c: | ||
sda: GPIO7 # Pin 21 | ||
scl: GPIO6 # Pin 20 | ||
scan: false | ||
|
||
uart: | ||
- id: uart_pm1 | ||
baud_rate: 9600 | ||
rx_pin: GPIO20 # Pin 30 / RXD0 | ||
tx_pin: GPIO21 # Pin 31 / TXD0 | ||
- id: uart_pm2 | ||
baud_rate: 9600 | ||
rx_pin: GPIO0 # Pin 12 | ||
tx_pin: GPIO1 # Pin 13 | ||
|
||
sensor: | ||
- platform: pmsx003 | ||
type: PMSX003 | ||
uart_id: uart_pm1 | ||
update_interval: 3min # Sensor will go into sleep mode for extended operation lifetime | ||
pm_1_0: | ||
id: pm1_1_0 | ||
name: "${upper_devicename} Particulate Matter <1.0µm Concentration (1)" | ||
pm_2_5: | ||
id: pm1_2_5 | ||
name: "${upper_devicename} Particulate Matter <2.5µm Concentration (1)" | ||
pm_10_0: | ||
id: pm1_10_0 | ||
name: "${upper_devicename} Particulate Matter <10.0µm Concentration (1)" | ||
pm_0_3um: | ||
id: pm1_0_3um | ||
name: "${upper_devicename} Particulate Matter >0.3µm Count (1)" | ||
pm_0_5um: | ||
id: pm1_0_5um | ||
name: "${upper_devicename} Particulate Matter >0.5µm Count (1)" | ||
pm_1_0um: | ||
id: pm1_1_0um | ||
name: "${upper_devicename} Particulate Matter >1.0µm Count (1)" | ||
pm_2_5um: | ||
id: pm1_2_5um | ||
name: "${upper_devicename} Particulate Matter >2.5µm Count (1)" | ||
temperature: | ||
id: pm1_temperature | ||
name: "${upper_devicename} Temperature (1)" | ||
humidity: | ||
id: pm1_humidity | ||
accuracy_decimals: 1 | ||
name: "${upper_devicename} Relative Humidity (1)" | ||
|
||
- platform: pmsx003 | ||
type: PMSX003 | ||
uart_id: uart_pm2 | ||
update_interval: 3min # Sensor will go into sleep mode for extended operation lifetime | ||
pm_1_0: | ||
id: pm2_1_0 | ||
name: "${upper_devicename} Particulate Matter <1.0µm Concentration (2)" | ||
pm_2_5: | ||
id: pm2_2_5 | ||
name: "${upper_devicename} Particulate Matter <2.5µm Concentration (2)" | ||
pm_10_0: | ||
id: pm2_10_0 | ||
name: "${upper_devicename} Particulate Matter <10.0µm Concentration (2)" | ||
pm_0_3um: | ||
id: pm2_0_3um | ||
name: "${upper_devicename} Particulate Matter >0.3µm Count (2)" | ||
pm_0_5um: | ||
id: pm2_0_5um | ||
name: "${upper_devicename} Particulate Matter >0.5µm Count (2)" | ||
pm_1_0um: | ||
id: pm2_1_0um | ||
name: "${upper_devicename} Particulate Matter >1.0µm Count (2)" | ||
pm_2_5um: | ||
id: pm2_2_5um | ||
name: "${upper_devicename} Particulate Matter >2.5µm Count (2)" | ||
temperature: | ||
id: pm2_temperature | ||
name: "${upper_devicename} Temperature (2)" | ||
humidity: | ||
id: pm2_humidity | ||
accuracy_decimals: 1 | ||
name: "${upper_devicename} Relative Humidity (2)" | ||
|
||
# Calculate the average sensor values | ||
- platform: template | ||
id: temperature | ||
name: "${upper_devicename} Temperature" | ||
icon: mdi:home-thermometer-outline | ||
accuracy_decimals: 1 | ||
lambda: return (id(pm1_temperature).state + id(pm2_temperature).state) / 2; | ||
- platform: template | ||
id: humidity | ||
name: "${upper_devicename} Relative Humidity" | ||
icon: mdi:water-percent | ||
accuracy_decimals: 1 | ||
unit_of_measurement: "%" | ||
lambda: return (id(pm1_humidity).state + id(pm2_humidity).state) / 2; | ||
- platform: template | ||
id: pm_1_0 | ||
name: "${upper_devicename} Particulate Matter <1.0µm Concentration" | ||
icon: mdi:chemical-weapon | ||
accuracy_decimals: 0 | ||
unit_of_measurement: µg/m³ | ||
lambda: return (id(pm1_1_0).state + id(pm2_1_0).state) / 2; | ||
- platform: template | ||
id: pm_2_5 | ||
name: "${upper_devicename} Particulate Matter <2.5µm Concentration" | ||
icon: mdi:chemical-weapon | ||
accuracy_decimals: 0 | ||
unit_of_measurement: µg/m³ | ||
lambda: return (id(pm1_2_5).state + id(pm2_2_5).state) / 2; | ||
- platform: template | ||
id: pm_10_0 | ||
name: "${upper_devicename} Particulate Matter <10.0µm Concentration" | ||
icon: mdi:chemical-weapon | ||
accuracy_decimals: 0 | ||
unit_of_measurement: µg/m³ | ||
lambda: return (id(pm1_10_0).state + id(pm2_10_0).state) / 2; | ||
- platform: template | ||
id: pm_0_3um | ||
name: "${upper_devicename} Particulate Matter >0.3µm Count" | ||
icon: mdi:counter | ||
accuracy_decimals: 0 | ||
unit_of_measurement: /dL | ||
lambda: return (id(pm1_0_3um).state + id(pm2_0_3um).state) / 2; | ||
- platform: template | ||
id: pm_0_5um | ||
name: "${upper_devicename} Particulate Matter >0.5µm Count" | ||
icon: mdi:counter | ||
accuracy_decimals: 0 | ||
unit_of_measurement: /dL | ||
lambda: return (id(pm1_0_5um).state + id(pm2_0_5um).state) / 2; | ||
- platform: template | ||
id: pm_1_0um | ||
name: "${upper_devicename} Particulate Matter >1.0µm Count" | ||
icon: mdi:counter | ||
accuracy_decimals: 0 | ||
unit_of_measurement: /dL | ||
lambda: return (id(pm1_1_0um).state + id(pm2_1_0um).state) / 2; | ||
- platform: template | ||
id: pm_2_5um | ||
name: "${upper_devicename} Particulate Matter >2.5µm Count" | ||
icon: mdi:counter | ||
accuracy_decimals: 0 | ||
unit_of_measurement: /dL | ||
lambda: return (id(pm1_2_5um).state + id(pm2_2_5um).state) / 2; | ||
|
||
- platform: wifi_signal | ||
name: "Wifi Strength" | ||
id: wifirssi | ||
disabled_by_default: true | ||
update_interval: 10s | ||
|
||
- platform: uptime | ||
name: "Uptime Sensor" | ||
id: uptime_sensor | ||
update_interval: 60s |