You are of course right. This is the (slightly shortened, took out fonts etc part) code.
esphome:
name: klima-keller
friendly_name: Klima Keller
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "redacted"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.0.82
gateway: 192.168.0.1
subnet: 255.255.255.0
captive_portal:
sensor:
# Counter
- platform: homeassistant
id: counter
entity_id: sensor.counter_sensor_esp
internal: true
# Temperaturen
- platform: homeassistant
id: TempAussen
entity_id: sensor.htp_ausen_temperatur
internal: true
- platform: homeassistant
id: TempSchlafen
entity_id: sensor.htp_schlafzimmer_temperatur
internal: true
- platform: homeassistant
id: TempWaschen
entity_id: sensor.htp_waschekeller_temperatur
internal: true
- platform: homeassistant
id: TempGast
entity_id: sensor.htp_gastezimmer_temperatur
internal: true
# Feuchtigkeit
- platform: homeassistant
id: FeuchtAussen
entity_id: sensor.htp_ausen_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtSchlafen
entity_id: sensor.htp_schlafzimmer_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtWaschen
entity_id: sensor.htp_waschekeller_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtGast
entity_id: sensor.htp_gastezimmer_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtAussenAbs
entity_id: sensor.aussen_absolute_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtSchlafenAbs
entity_id: sensor.schlafzimmer_absolute_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtWaschenAbs
entity_id: sensor.waschekeller_absolute_luftfeuchtigkeit
internal: true
- platform: homeassistant
id: FeuchtGastAbs
entity_id: sensor.gastezimmer_absolute_luftfeuchtigkeit
internal: true
# Zeit
time:
- platform: homeassistant
id: time_homeassistant
# Status Lüften
text_sensor:
- platform: homeassistant
id: lft_schlafen
entity_id: input_text.lft_schlafzimmer
internal: true
- platform: homeassistant
id: lft_gast
entity_id: input_text.lft_gaestezimmer
internal: true
- platform: homeassistant
id: lft_waschen
entity_id: input_text.lft_waeschekeller
internal: true
########################################################################
spi: ###################################################################
########################################################################
clk_pin: GPIO13
mosi_pin: GPIO14
deep_sleep:
run_duration: 10s
sleep_duration: 300s
########################################################################
display: ###############################################################
########################################################################
- platform: waveshare_epaper
id: eink_display
cs_pin: GPIO15
dc_pin: GPIO27
busy_pin: GPIO25
reset_pin: GPIO26
model: 2.13in-ttgo-dke
full_update_every: 2
update_interval: 60s
rotation: 90°
reset_duration: 2ms
pages:
- id: page1
lambda: |-
it.print(50, 5, id(openSansBold), "Außen");
it.print(110, 5, id(openSansBold), "Schlafen");
it.print(180, 5, id(openSansBold), "Gast");
it.print(5, 35, id(materialdesign_icons_32), "\U000F050F");
it.print(5, 65, id(materialdesign_icons_32), "\U000F058C");
it.strftime(5, 95, id(openSansBold), "%H:%M", id(time_homeassistant).now());
if(id(counter).has_state()){
if(id(counter).state == 0){
it.printf(50, 70, id(openSansBold14), "%.1f %%", id(FeuchtAussen).state);
it.printf(110, 70, id(openSansBold14), "%.1f %%", id(FeuchtSchlafen).state);
it.printf(180, 70, id(openSansBold14), "%.1f %%", id(FeuchtGast).state);
}
else if(id(counter).state == 1){
it.printf(50, 70, id(openSansBold14), "%.1f g/m\U000000B3", id(FeuchtAussenAbs).state);
it.printf(110, 70, id(openSansBold14), "%.1f g/m\U000000B3", id(FeuchtSchlafenAbs).state);
it.printf(180, 70, id(openSansBold14), "%.1f g/m\U000000B3", id(FeuchtGastAbs).state);
}
else {
it.print (60, 65, id(openSansBold), "Debug: Counter Error");
}
}
it. printf(50, 40, id(openSansBold14), "%.1f °C", id(TempAussen).state);
it. printf(110, 40, id(openSansBold14), "%.1f °C", id(TempSchlafen).state);
it. printf(180, 40, id(openSansBold14), "%.1f °C", id(TempGast).state);
if(id(lft_schlafen).has_state()){
if(id(lft_schlafen).state == "OK") {
it.printf(110, 95, id(materialdesign_icons_32), "\U000F0A50");
}
else if(id(lft_schlafen).state == "Öffnen") {
it.printf(110, 95, id(materialdesign_icons_32), "\U000F1846");
}
else if(id(lft_schlafen).state == "Schließen") {
it.printf(110, 95, id(materialdesign_icons_32), "\U000F1847");
}
else {
it.printf(110, 95, id(materialdesign_icons_32), "Fehler");
}
}
if(id(lft_gast).has_state()){
if(id(lft_gast).state == "OK") {
it.printf(180, 95, id(materialdesign_icons_32), "\U000F0A50");
}
else if(id(lft_gast).state == "Öffnen") {
it.printf(180, 95, id(materialdesign_icons_32), "\U000F1846");
}
else if(id(lft_gast).state == "Schließen") {
it.printf(180, 95, id(materialdesign_icons_32), "\U000F1847");
}
else {
it.printf(180, 95, id(materialdesign_icons_32), "Fehler");
}
}
- id: page2
lambda: |-
it.print(50, 5, id(openSansBold), "Außen");
it.print(110, 5, id(openSansBold), "Waschkeller");
it.print(5, 35, id(materialdesign_icons_32), "\U000F050F");
it.print(5, 65, id(materialdesign_icons_32), "\U000F058C");
it.strftime(5, 95, id(openSansBold), "%H:%M", id(time_homeassistant).now());
if(id(counter).has_state()){
if(id(counter).state == 0){
it.printf(50, 70, id(openSansBold14), "%.1f %%", id(FeuchtAussen).state);
it.printf(110, 70, id(openSansBold14), "%.1f %%", id(FeuchtWaschen).state);
}
else if(id(counter).state == 1){
it.printf(50, 70, id(openSansBold14), "%.1f g/m\U000000B3", id(FeuchtAussenAbs).state);
it.printf(110, 70, id(openSansBold14), "%.1f g/m\U000000B3", id(FeuchtWaschenAbs).state);
}
else {
it.print (60, 65, id(openSansBold), "Debug: Counter Error");
}
}
it. printf(50, 40, id(openSansBold14), "%.1f °C", id(TempAussen).state);
it. printf(110, 40, id(openSansBold14), "%.1f °C", id(TempWaschen).state);
if(id(lft_waschen).has_state()){
if(id(lft_waschen).state == "OK") {
it.printf(110, 95, id(materialdesign_icons_32), "\U000F0A50");
}
else if(id(lft_waschen).state == "Öffnen") {
it.printf(110, 95, id(materialdesign_icons_32), "\U000F1846");
}
else if(id(lft_waschen).state == "Schließen") {
it.printf(110, 95, id(materialdesign_icons_32), "\U000F1847");
}
else {
it.printf(110, 95, id(materialdesign_icons_32), "Fehler");
}
}
interval:
- interval: 6s
then:
- display.page.show_next: eink_display
- component.update: eink_display
This works fine except that after coming back from deep_sleep, the sensors show “nan” state on the display first, at some point they will get their values.
What I want is that they always store the last value and update when there is new data. Without deep_sleep this works, with deep sleep it shows the described behaviour.