Browse Source

all sensors

esphome
Hendrik Langer 3 years ago
parent
commit
f015923be2
  1. 105
      esp32weatherstation2.yaml
  2. BIN
      fonts/Vera.ttf
  3. BIN
      fonts/VeraMono.ttf

105
esp32weatherstation2.yaml

@ -22,6 +22,9 @@ api:
ota: ota:
password: !secret esphome_ota_password password: !secret esphome_ota_password
# on_begin:
# then:
# - logger.log: "OTA start"
wifi: wifi:
networks: networks:
@ -65,9 +68,15 @@ uart:
# display #250x122 pixels # display #250x122 pixels
font: font:
- file: 'fonts/slkscr.ttf' - file: 'fonts/Vera.ttf'
id: font1 id: font1
size: 8 size: 10
- file: 'fonts/Vera.ttf'
id: font2
size: 20
# - file: 'fonts/VeraMono.ttf'
# id: font3
# size: 10
status_led: status_led:
pin: pin:
@ -83,13 +92,56 @@ display:
rotation: 90 rotation: 90
update_interval: 30s update_interval: 30s
full_update_every: 1 full_update_every: 1
id: my_display
pages:
# - id: page1
# lambda: |-
# it.print(10, 10, id(font2), "esp32weatherstation2");
- id: page2
lambda: |- lambda: |-
it.print(5, 6, id(font1), "Hello World!"); it.print(5, 6, id(font1), "Hello World!");
it.strftime(130, 6, id(font1), "%Y-%m-%d %H:%M", id(sntp_time).now()); it.strftime(150, 6, id(font1), "%Y-%m-%d %H:%M", id(sntp_time).now());
it.line(0, 15, 250, 15); 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) { if (id(temperature).state) {
it.printf(5, 40, id(font1), "Temperature: %.1f°C, Humidity: %.1f%%, Pressure: %.1fhPa", id(temperature).state, id(humidity).state, id(pressure).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
sensor: sensor:
# BME680 Temperature+Pressure+Humidity+Gas Sensor # BME680 Temperature+Pressure+Humidity+Gas Sensor
@ -106,47 +158,54 @@ sensor:
id: humidity id: humidity
gas_resistance: gas_resistance:
name: "BME680 Gas Resistance" name: "BME680 Gas Resistance"
id: voc
address: 0x77 address: 0x77
update_interval: 60s update_interval: 60s
# BME280 Temperature+Pressure+Humidity Sensor # BME280 Temperature+Pressure+Humidity Sensor
- platform: bme280 - platform: bme280
temperature: temperature:
name: "BME280 Temperature" name: "BME280 Temperature"
id: temperature2
oversampling: 16x oversampling: 16x
pressure: pressure:
name: "BME280 Pressure" name: "BME280 Pressure"
id: pressure2
humidity: humidity:
name: "BME280 Humidity" name: "BME280 Humidity"
id: humidity2
address: 0x77 address: 0x77
update_interval: 60s update_interval: 60s
# SDS 011 Particulate Matter Sensor # SDS 011 Particulate Matter Sensor
- platform: sds011 - platform: sds011
pm_2_5: pm_2_5:
name: "Particulate Matter <2.5µm Concentration" name: "Particulate Matter <2.5µm Concentration"
id: pm2
pm_10_0: pm_10_0:
name: "Particulate Matter <10.0µm Concentration" name: "Particulate Matter <10.0µm Concentration"
id: pm10
update_interval: 5min update_interval: 5min
# BH1750 Ambient Light Sensor # BH1750 Ambient Light Sensor
- platform: bh1750 - platform: bh1750
name: "BH1750 Illuminance" name: "BH1750 Illuminance"
id: lux
address: 0x23 address: 0x23
measurement_duration: 69 measurement_duration: 69
update_interval: 60s update_interval: 60s
# VEML6075 UV sensor # VEML6075 UV sensor
- platform: custom # - platform: custom
lambda: |- # lambda: |-
auto veml6075 = new VEML6075CustomSensor(); # auto veml6075 = new VEML6075CustomSensor();
App.register_component(veml6075); # App.register_component(veml6075);
return {veml6075->uva_sensor, veml6075->uvb_sensor}; # return {veml6075->uva_sensor, veml6075->uvb_sensor};
sensors: # sensors:
- name: "zelva UVA" # - name: "zelva UVA"
id: zelva_uva # id: uva
unit_of_measurement: "mW/cm²" # unit_of_measurement: "mW/cm²"
accuracy_decimals: 0 # accuracy_decimals: 0
- name: "zelva UVB" # - name: "zelva UVB"
id: zelva_uvb # id: uvb
unit_of_measurement: "mW/cm²" # unit_of_measurement: "mW/cm²"
accuracy_decimals: 0 # accuracy_decimals: 0
# Example configuration entry # Example configuration entry
- platform: esp32_hall - platform: esp32_hall
name: "ESP32 Hall Sensor" name: "ESP32 Hall Sensor"
@ -161,3 +220,11 @@ esp32_ble_tracker:
#text_sensor: #text_sensor:
# - platform: ble_scanner # - platform: ble_scanner
# name: "BLE Devices Scanner" # name: "BLE Devices Scanner"
#on_...:
# if:
# condition:
# api.connected:
# then:
# - logger.log: API is connected!
# - display.page.show: page2

BIN
fonts/Vera.ttf

Binary file not shown.

BIN
fonts/VeraMono.ttf

Binary file not shown.
Loading…
Cancel
Save