Wetterstation v2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
5.9 KiB

3 years ago
esphome:
name: esp32weatherstation2
platform: ESP32
board: lolin_d32_pro
includes:
- veml6075_custom_sensor.h
libraries:
- "https://github.com/adafruit/Adafruit_VEML6075"
- "https://github.com/adafruit/Adafruit_BusIO"
platformio_options:
lib_ldf_mode: chain+
project:
name: "xd0.esp32weatherstation2"
version: "0.0.3"
3 years ago
# Enable logging
logger:
# level: VERY_VERBOSE
# Enable Home Assistant API
api:
ota:
password: !secret esphome_ota_password
3 years ago
# on_begin:
# then:
# - logger.log: "OTA start"
3 years ago
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_passwd
- ssid: !secret wifi_ssid2
password: !secret wifi_passwd2
3 years ago
power_save_mode: light
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32Weatherstation2"
password: "ucYwmU1xwUxh"
3 years ago
captive_portal:
time:
- platform: sntp
id: sntp_time
timezone: "Europe/Berlin"
#mqtt:
# broker: home.xd0.de
# username: !secret esphome_mqtt_user
# password: !secret esphome_mqtt_passwd
3 years ago
i2c:
sda: 21
scl: 22
scan: true
spi:
clk_pin: 18
mosi_pin: 23
miso_pin: 19
uart:
rx_pin: 15
tx_pin: 2
baud_rate: 9600
# display #250x122 pixels
font:
3 years ago
- file: 'fonts/Vera.ttf'
3 years ago
id: font1
3 years ago
size: 10
- file: 'fonts/Vera.ttf'
id: font2
size: 20
# - file: 'fonts/VeraMono.ttf'
# id: font3
# size: 10
3 years ago
status_led:
pin:
number: GPIO5
inverted: true
display:
- platform: waveshare_epaper
cs_pin: 14
dc_pin: 27
reset_pin: 33
model: 2.13in-ttgo
rotation: 90
update_interval: 30s
full_update_every: 1
3 years ago
id: my_display
pages:
# - id: page1
# lambda: |-
# it.print(10, 10, id(font2), "esp32weatherstation2");
- id: page2
lambda: |-
it.print(5, 6, id(font1), "Hello World!");
it.strftime(150, 6, id(font1), "%Y-%m-%d %H:%M", id(sntp_time).now());
it.line(0, 20, 250, 20);
it.filled_rectangle(0, 20, 70, 122, COLOR_ON);
it.line(0, 54, 70, 54, COLOR_OFF);
it.line(0, 88, 70, 88, COLOR_OFF);
if (id(temperature).state) {
it.printf(2, 21+4, id(font2), COLOR_OFF, "%.1f", id(temperature).state); it.printf(55, 21+4, id(font1), COLOR_OFF, "°C");
it.printf(2, 55+4, id(font2), COLOR_OFF, "%.1f", id(humidity).state); it.printf(55, 55+4, id(font1), COLOR_OFF, "%%");
it.printf(2, 89+4, id(font2), COLOR_OFF, "%.0f", id(pressure).state); it.printf(55, 89+4, id(font1), COLOR_OFF, "hPa");
it.graph(70, 21, id(temperature_graph));
it.graph(70, 55, id(humidity_graph));
it.graph(70, 89, id(pressure_graph));
} else if (id(temperature2).state) {
it.printf(2, 21+4, id(font2), COLOR_OFF, "%.1f", id(temperature2).state); it.printf(55, 21+4, id(font1), COLOR_OFF, "°C");
it.printf(2, 55+4, id(font2), COLOR_OFF, "%.1f", id(humidity2).state); it.printf(55, 55+4, id(font1), COLOR_OFF, "%%");
it.printf(2, 89+4, id(font2), COLOR_OFF, "%.0f", id(pressure2).state); it.printf(55, 89+4, id(font1), COLOR_OFF, "hPa");
}
it.printf(133, 21, id(font1), "PM2.5: %.1f", id(pm2).state);
it.printf(133, 31, id(font1), "PM10 : %.1f", id(pm10).state);
it.printf(133, 41, id(font1), "VOC : %.1f k\xe9", id(voc).state);
it.printf(133, 51, id(font1), "Lux : %.1f lx", id(lux).state);
# it.printf(130, 61, id(font1), "UVI : %.1f", id(uva).state);
# it.printf(130, 71, id(font1), "UVA : %.1f", id(uva).state);
# it.printf(130, 81, id(font1), "UVB : %.1f", id(uvb).state);
graph:
# Show bare-minimum auto-ranged graph
- id: temperature_graph
sensor: temperature
duration: 1h
width: 60
height: 32
- id: humidity_graph
sensor: humidity
duration: 1h
width: 60
height: 32
- id: pressure_graph
sensor: pressure
duration: 1h
width: 60
height: 32
3 years ago
sensor:
# BME680 Temperature+Pressure+Humidity+Gas Sensor
- platform: bme680
temperature:
name: "BME680 Temperature"
oversampling: 16x
id: temperature
pressure:
name: "BME680 Pressure"
id: pressure
humidity:
name: "BME680 Humidity"
id: humidity
gas_resistance:
name: "BME680 Gas Resistance"
3 years ago
id: voc
3 years ago
address: 0x77
update_interval: 60s
# BME280 Temperature+Pressure+Humidity Sensor
- platform: bme280
temperature:
name: "BME280 Temperature"
3 years ago
id: temperature2
3 years ago
oversampling: 16x
pressure:
name: "BME280 Pressure"
3 years ago
id: pressure2
3 years ago
humidity:
name: "BME280 Humidity"
3 years ago
id: humidity2
3 years ago
address: 0x77
update_interval: 60s
# SDS 011 Particulate Matter Sensor
- platform: sds011
pm_2_5:
name: "Particulate Matter <2.5µm Concentration"
3 years ago
id: pm2
3 years ago
pm_10_0:
name: "Particulate Matter <10.0µm Concentration"
3 years ago
id: pm10
3 years ago
update_interval: 5min
# BH1750 Ambient Light Sensor
- platform: bh1750
name: "BH1750 Illuminance"
3 years ago
id: lux
3 years ago
address: 0x23
measurement_duration: 69
update_interval: 60s
# VEML6075 UV sensor
3 years ago
# - platform: custom
# lambda: |-
# auto veml6075 = new VEML6075CustomSensor();
# App.register_component(veml6075);
# return {veml6075->uva_sensor, veml6075->uvb_sensor};
# sensors:
# - name: "zelva UVA"
# id: uva
# unit_of_measurement: "mW/cm²"
# accuracy_decimals: 0
# - name: "zelva UVB"
# id: uvb
# unit_of_measurement: "mW/cm²"
# accuracy_decimals: 0
# ESP32 integrated hall sensor
# - platform: esp32_hall
# name: "ESP32 Hall Sensor"
# update_interval: 60s
# - platform: ble_rssi
# mac_address: FA:4E:84:FF:4D:16
# name: "MiBand Hendrik RSSI value"
3 years ago
# Example configuration entry
# esp32_ble_tracker:
3 years ago
#text_sensor:
# - platform: ble_scanner
# name: "BLE Devices Scanner"
3 years ago
#on_...:
# if:
# condition:
# api.connected:
# then:
# - logger.log: API is connected!
# - display.page.show: page2