external_components: - source: my_components components: [waveshare_epaper] esphome: name: doorwhat friendly_name: doorwhat esp32: board: esp32dev framework: type: esp-idf logger: api: encryption: key: "gLfRXKqMU9IvvwZnIdrWYIclAnc4q5sHVwTkRzUxKyw=" ota: - platform: esphome password: "1618b7dc423684c5d3661481ce284359" font: - file: "gfonts://Roboto" id: my_font size: 18 image: - file: "cat.svg" id: cat_img resize: 64x64 type: BINARY wifi: ssid: !secret wifi_ssid password: !secret wifi_password ap: ssid: "Doorwhat Fallback Hotspot" password: "KBiNyP7EkHCJ" captive_portal: time: - platform: homeassistant id: ha_time sensor: - platform: homeassistant entity_id: sensor.shellyhtg3_8cbfeaa53d88_humidity id: bad_feuchtigkeit spi: clk_pin: 2 mosi_pin: 15 color: - id: red hex: "FF0000" - id: black hex: "FFFFFF" globals: - id: last_on_time type: std::string restore_value: no initial_value: '"Noch nie"' - id: previous_on_time type: std::string restore_value: no initial_value: '"Noch nie"' text_sensor: - platform: template name: "Letzter Gong" id: letzter_gong_sensor - platform: template name: "Vorheriger Gong" id: vorheriger_gong_sensor binary_sensor: - platform: gpio pin: number: 18 mode: INPUT id: opto_in name: "Optokoppler Eingang" on_press: then: - lambda: |- auto time = id(ha_time).now(); std::string new_time; if (time.is_valid()) { new_time = time.strftime("%Y-%m-%d %H:%M:%S"); } else { new_time = "Zeit unbekannt"; } id(previous_on_time) = id(last_on_time); id(last_on_time) = new_time; id(letzter_gong_sensor).publish_state(id(last_on_time)); id(vorheriger_gong_sensor).publish_state(id(previous_on_time)); - component.update: my_display display: - platform: waveshare_epaper model: 2.90in3c cs_pin: 4 dc_pin: 16 reset_pin: 17 busy_pin: 5 rotation: 270 reset_duration: 2ms id: my_display update_interval: 600s # alle 10 Minuten automatisch lambda: |- it.print(0, 4, id(my_font), id(black), "DoorWhat v1.0"); it.print(170, 65, id(my_font), id(red), "Meow!"); it.image(186, 1, id(cat_img)); it.print(0, 30, id(my_font), id(black), "Letzter Gong:"); it.print(0, 50, id(my_font), id(red), id(last_on_time).c_str()); it.print(0, 70, id(my_font), id(black), "Vorheriger Gong:"); it.print(0, 90, id(my_font), id(red), id(previous_on_time).c_str());