Last active
April 6, 2024 02:44
-
-
Save NateEaton/c5c2ad196ff7f2a68975e2953d5f28b6 to your computer and use it in GitHub Desktop.
Data Collection Components for Total Solar Eclipse using ESPHOME and Home Assistant
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
esphome: | |
name: environment | |
friendly_name: environment | |
esp32: | |
board: esp32dev | |
framework: | |
type: arduino | |
# Enable logging | |
logger: | |
level: DEBUG | |
# Enable Home Assistant API | |
api: | |
encryption: | |
key: "[private]" | |
ota: | |
password: "[private]" | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Environment Fallback Hotspot" | |
password: "[private]" | |
captive_portal: | |
time: | |
- platform: homeassistant | |
id: homeassistant_time | |
spi: | |
clk_pin: GPIO18 | |
mosi_pin: GPIO23 | |
miso_pin: GPIO19 | |
sensor: | |
- platform: bme280_spi | |
id: bme280_environment | |
temperature: | |
name: "Temperature" | |
id: bme280_temperature | |
accuracy_decimals: 1 | |
oversampling: 16x | |
pressure: | |
name: "Pressure" | |
id: bme280_pressure | |
accuracy_decimals: 1 | |
humidity: | |
name: "Relative Humidity" | |
id: bme280_relative_humidity | |
accuracy_decimals: 5 | |
iir_filter: 8x | |
cs_pin: GPIO5 | |
update_interval: never | |
- platform: template | |
name: "Absolute Humidity" | |
id: bme280_absolute_humidity | |
lambda: |- | |
const float mw = 18.01534; // molar mass of water g/mol | |
const float r = 8.31447215; // Universal gas constant J/mol/K | |
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / | |
(id(bme280_temperature).state + 243.5)) * id(bme280_relative_humidity).state * mw) / | |
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3 | |
accuracy_decimals: 2 | |
update_interval: never | |
icon: 'mdi:water' | |
unit_of_measurement: 'g/m^3' | |
- platform: template | |
name: "Dew Point" | |
id: bme280_dew_point | |
lambda: |- | |
double dew_point_celsius = (243.5*(log(id(bme280_relative_humidity).state/100)+((17.67*id(bme280_temperature).state)/ | |
(243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_relative_humidity).state/100)- | |
((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))); | |
return dew_point_celsius * 9.0/5.0 + 32.0; | |
update_interval: never | |
icon: 'mdi:thermometer-alert' | |
unit_of_measurement: '°F' | |
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB | |
name: "WiFi Signal dB" | |
id: wifi_signal_db | |
update_interval: 60s | |
entity_category: "diagnostic" | |
- platform: copy # Reports the WiFi signal strength in % | |
source_id: wifi_signal_db | |
name: "WiFi Signal Percent" | |
filters: | |
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0); | |
unit_of_measurement: "Signal %" | |
entity_category: "diagnostic" | |
- platform: uptime | |
name: "Uptime" | |
update_interval: 60s | |
entity_category: "diagnostic" | |
binary_sensor: | |
- platform: template | |
name: "High Speed Update" | |
id: high_speed_update | |
lambda: |- | |
return id(high_speed_update).state; | |
- platform: status | |
name: "Connectivity Status" | |
id: connectivity_status | |
device_class: connectivity | |
switch: | |
- platform: template | |
name: "High Speed Update Switch" | |
restore_mode: ALWAYS_OFF | |
lambda: |- | |
return id(high_speed_update).state; | |
turn_on_action: | |
- binary_sensor.template.publish: | |
id: high_speed_update | |
state: ON | |
- logger.log: High Speed Update Switched On | |
turn_off_action: | |
- binary_sensor.template.publish: | |
id: high_speed_update | |
state: OFF | |
- logger.log: High Speed Update Switched Off | |
interval: | |
- interval: 1min | |
then: | |
- if: | |
condition: | |
lambda: 'return not id(high_speed_update).state;' | |
then: | |
- component.update: bme280_environment | |
- component.update: bme280_absolute_humidity | |
- component.update: bme280_dew_point | |
- interval: 1sec | |
then: | |
- if: | |
condition: | |
lambda: 'return id(high_speed_update).state;' | |
then: | |
- component.update: bme280_environment | |
- component.update: bme280_absolute_humidity | |
- component.update: bme280_dew_point | |
text_sensor: | |
- platform: version | |
name: "Version" | |
icon: mdi:cube-outline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment