Files
esphome/_data/weather-in-1.yaml
2022-04-24 08:00:50 -07:00

75 lines
1.9 KiB
YAML

substitutions:
device_name: In1
esphome:
name: weather-in-1
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "38fdad38872738fe7c08f77643ed5d56"
wifi:
ssid: !secret wifi_oss_ssid
password: !secret wifi_oss_password
manual_ip:
static_ip: 192.168.35.246
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Weather-Out-S Fallback Hotspot"
password: "0xINHxW0IbSK"
captive_portal:
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
sensor:
- platform: bme280
temperature:
name: Temp${device_name}
id: bme280_temperature
pressure:
name: Press${device_name}
id: bme280_pressure
humidity:
name: HumidityRel${device_name}
id: bme280_humidity
address: 0x76
update_interval: 15s
# Templates from https://esphome.io/cookbook/bme280_environment.html
- platform: template
name: HumidityAbs${device_name}
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_humidity).state * mw) /
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
accuracy_decimals: 2
update_interval: 15s
icon: 'mdi:water'
unit_of_measurement: 'g/m³'
- platform: template
name: DewPt${device_name}
lambda: |-
return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/
(243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)-
((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state))));
unit_of_measurement: °C
icon: 'mdi:thermometer-alert'