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.

294 lines
11 KiB

# display #250x122 pixels (250x128)
font:
- file: 'fonts/Vera.ttf'
id: font1
size: 10
3 years ago
glyphs: '!"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/²³µΩ€[]?'
- file: 'fonts/Vera.ttf'
id: font2
size: 20
# - file: 'fonts/VeraMono.ttf'
# id: font3
# size: 10
- file: 'fonts/materialdesignicons-webfont.ttf'
id: icon_font
size: 48
glyphs:
- "\U000F0590" # weather-cloudy
- "\U000F0F2F" # weather-cloudy-alert
- "\U000F0E6E" # weather-cloudy-arrow-right
- "\U000F0591" # weather-fog
- "\U000F0592" # weather-hail
- "\U000F0F30" # weather-hazy
- "\U000F0898" # weather-hurricane
- "\U000F0593" # weather-lightning
- "\U000F067E" # weather-lightning-rainy
- "\U000F0594" # weather-night
- "\U000F0F31" # weather-night-partly-cloudy
- "\U000F0595" # weather-partly-cloudy
- "\U000F0F32" # weather-partly-lightning
- "\U000F0F33" # weather-partly-rainy
- "\U000F0F34" # weather-partly-snowy
- "\U000F0F35" # weather-partly-snowy-rainy
- "\U000F0596" # weather-pouring
- "\U000F0597" # weather-rainy
- "\U000F0598" # weather-snowy
- "\U000F0F36" # weather-snowy-heavy
- "\U000F067F" # weather-snowy-rainy
- "\U000F0599" # weather-sunny
- "\U000F0F37" # weather-sunny-alert
- "\U000F14E4" # weather-sunny-off
- "\U000F059A" # weather-sunset
- "\U000F059B" # weather-sunset-down
- "\U000F059C" # weather-sunset-up
- "\U000F0F38" # weather-tornado
- "\U000F059D" # weather-windy
- "\U000F059E" # weather-windy-variant
display:
- platform: waveshare_epaper
cs_pin: 14
dc_pin: 27
reset_pin: 33
model: 2.13in-ttgo
rotation: 90
update_interval: 60s
full_update_every: 1
id: my_display
pages:
- id: page1
lambda: |-
it.print(10, 50, id(font2), "esp32weatherstation2");
- id: page2
lambda: |-
// Title
it.filled_rectangle(0,0,250,20, COLOR_ON);
it.print(5, 6, id(font1), COLOR_OFF, "${node_name}");
it.strftime(150, 6, id(font1), COLOR_OFF, "%Y-%m-%d %H:%M", id(sntp_time).now());
// Weather icon
if (id(weather_icon).has_state()) {
it.printf(0, 18, id(icon_font), weather_icon_map[id(weather_icon).state.c_str()].c_str());
}
it.printf(55, 25, id(font1), "T: %.1f°C", id(temperature_outside).state);
it.printf(55, 35, id(font1), "H: %.1f%%", id(humidity_outside).state);
it.printf(55, 45, id(font1), "%s", id(weather_icon).state.c_str());
// own measurements
it.filled_rectangle(0, 65, 59, 33, COLOR_ON);
it.printf(2, 65+4, id(font2), COLOR_OFF, "%.1f", id(temperature).state); it.printf(45, 65+4, id(font1), COLOR_OFF, "°C");
it.filled_rectangle(60, 65, 59, 33, COLOR_ON);
it.printf(62, 65+4, id(font2), COLOR_OFF, "%.1f", id(humidity).state); it.printf(105, 65+4, id(font1), COLOR_OFF, "%%");
it.filled_rectangle(120, 65, 59, 33, COLOR_ON);
it.printf(122, 65+4, id(font2), COLOR_OFF, "%.0f", id(pressure_sealevel).state); it.printf(178, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "hPa");
// humidity human readable
if (id(humidity).state < 30) {
it.printf(116, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "low");
} else if (id(humidity).state < 60) {
it.printf(116, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "comfort");
} else {
it.printf(116, 87, id(font1), COLOR_OFF, TextAlign::TOP_RIGHT, "high");
}
// graphs
it.graph(0, 98, id(temperature_graph));
it.graph(60, 98, id(humidity_graph));
it.graph(120, 98, id(pressure_graph));
// voc
it.circle(130, 42, 20);
it.line(115, 42, 145, 42);
it.filled_rectangle(130-10, 21, 20, 10, COLOR_OFF);
it.print(130, 26, id(font1), TextAlign::CENTER, "WZ");
3 years ago
if (id(iaq_accuracy_wz).state >= 2) {
3 years ago
it.printf(130, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f", id(iaq_wz).state);
if (id(iaq_wz).state < 50) {
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "excellent");
} else if (id(iaq_wz).state < 100) {
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "fine");
} else if (id(iaq_wz).state < 150) {
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "moderate");
} else if (id(iaq_wz).state < 200) {
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "poor");
} else if (id(iaq_wz).state < 300) {
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "very poor");
} else if (id(iaq_wz).state < 500) {
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "severe");
3 years ago
}
} else {
it.printf(130, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f \u03A9", id(voc_wz).state);
it.printf(130, 43, id(font1), TextAlign::TOP_CENTER, "VOC");
3 years ago
}
// voc2
it.circle(175, 42, 20);
it.line(160, 42, 190, 42);
it.filled_rectangle(175-10, 21, 20, 10, COLOR_OFF);
it.print(175, 26, id(font1), TextAlign::CENTER, "SZ");
3 years ago
if (id(iaq_accuracy_sz).state >= 2) {
3 years ago
it.printf(175, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f", id(iaq_sz).state);
if (id(iaq_sz).state < 50) {
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "excellent");
} else if (id(iaq_sz).state < 100) {
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "fine");
} else if (id(iaq_sz).state < 150) {
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "moderate");
} else if (id(iaq_sz).state < 200) {
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "poor");
} else if (id(iaq_sz).state < 300) {
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "very poor");
} else if (id(iaq_sz).state < 500) {
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "severe");
}
} else {
it.printf(175, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f \u03A9", id(voc_sz).state);
it.printf(175, 43, id(font1), TextAlign::TOP_CENTER, "VOC");
}
// Particulate Matter Sensor
it.circle(220, 42, 20);
it.line(205, 42, 235, 42);
it.filled_rectangle(220-10, 21, 20, 10, COLOR_OFF);
it.print(220, 26, id(font1), TextAlign::CENTER, "PM");
it.printf(220, 41, id(font1), TextAlign::BASELINE_CENTER, "%.0f", id(pm2_outdoor).state);
it.printf(220, 43, id(font1), TextAlign::TOP_CENTER, "%.0f", id(pm10_outdoor).state);
// other values
it.print(184, 65, id(font1), "Lux:"); it.printf(248, 65, id(font1), TextAlign::TOP_RIGHT, "%.0f lx", id(lux_outdoor).state);
it.print(184, 75, id(font1), "UVI:"); it.printf(248, 75, id(font1), TextAlign::TOP_RIGHT, "%.0f", id(uvi_outdoor).state);
it.print(184, 85, id(font1), "UVA:"); it.printf(248, 85, id(font1), TextAlign::TOP_RIGHT, "%.0f", id(uva_outdoor).state);
it.print(184, 95, id(font1), "UVB:"); it.printf(248, 95, id(font1), TextAlign::TOP_RIGHT, "%.0f", id(uvb_outdoor).state);
// Springer
it.print(184, 105, id(font1), "Springer");
if (id(battery_springer).state >=0 && id(battery_springer).state <= 100) {
it.printf(248, 105, id(font1), TextAlign::TOP_RIGHT, "%.0f%%", id(battery_springer).state);
3 years ago
} else {
it.printf(248, 105, id(font1), TextAlign::TOP_RIGHT, "nc");
}
it.printf(184,115, id(font1), "%.1f°C, %.1f%%H, %.0fhPa", id(temperature_springer).state, id(humidity_springer).state, id(pressure_springer).state);
interval:
- interval: 30s
then:
- if:
condition:
- display.is_displaying_page: page1
then:
- display.page.show: page2
- component.update: my_display
graph:
# Show bare-minimum auto-ranged graph
- id: temperature_graph
duration: 1h
width: 59
height: 31
traces:
- sensor: temperature
line_type: SOLID
line_thickness: 2
# - sensor: temperature_outside
# line_type: DASHED
# line_thickness: 1
- id: humidity_graph
sensor: humidity
duration: 1h
width: 59
height: 31
- id: pressure_graph
sensor: pressure
duration: 1h
width: 59
height: 31
# Example configuration entry
sensor:
- platform: homeassistant
name: "Temperature Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_temperature
id: temperature_outside
- platform: homeassistant
name: "Humidity Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_humidity
id: humidity_outside
- platform: homeassistant
name: "WZ VOC"
internal: true
entity_id: sensor.sensor_wz_gas_resistance
id: voc_wz
- platform: homeassistant
name: "SZ VOC"
internal: true
entity_id: sensor.sensor_sz_gas_resistance
id: voc_sz
- platform: homeassistant
name: "WZ IAQ"
internal: true
entity_id: sensor.sensor_wz_iaq
id: iaq_wz
- platform: homeassistant
name: "SZ IAQ"
internal: true
entity_id: sensor.sensor_sz_iaq
id: iaq_sz
- platform: homeassistant
name: "WZ IAQ Accuracy"
internal: true
entity_id: sensor.sensor_wz_iaq_accuracy
id: iaq_accuracy_wz
- platform: homeassistant
name: "SZ IAQ Accuracy"
internal: true
entity_id: sensor.sensor_sz_iaq_accuracy
id: iaq_accuracy_sz
- platform: homeassistant
name: "PM2.5 Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_particulate_matter_2_5um_concentration
id: pm2_outdoor
- platform: homeassistant
name: "PM10 Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_particulate_matter_10_0um_concentration
id: pm10_outdoor
- platform: homeassistant
name: "UVI Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_uvi
id: uvi_outdoor
- platform: homeassistant
name: "UVA Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_uva
id: uva_outdoor
- platform: homeassistant
name: "UVB Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_uvb
id: uvb_outdoor
- platform: homeassistant
name: "Illuminance Outdoor"
internal: true
entity_id: sensor.sensor_outdoor_illuminance
id: lux_outdoor
- platform: homeassistant
name: "Temperature Springer"
internal: true
entity_id: sensor.sensor_springer_temperature
id: temperature_springer
- platform: homeassistant
name: "Humidity Springer"
internal: true
entity_id: sensor.sensor_springer_humidity
id: humidity_springer
- platform: homeassistant
name: "Pressure Springer"
internal: true
entity_id: sensor.sensor_springer_equivalent_sea_level_pressure
id: pressure_springer
- platform: homeassistant
name: "Battery Springer"
internal: true
entity_id: sensor.sensor_springer_battery_level
id: battery_springer
text_sensor:
- platform: homeassistant
id: weather_icon
internal: true
entity_id: weather.openweathermap