esphome: name: esphome-clock friendly_name: ESPHome Clock esp32: board: esp32dev framework: type: arduino # Enable logging logger: logs: sensor: INFO # Enable Home Assistant API api: reboot_timeout: 0s encryption: key: "" ota: wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "ESP32Clock" password: "fallBackPass" captive_portal: web_server: local: true external_components: - source: type: local path: components time: - platform: sntp id: sntp_time timezone: Europe/Berlin on_time: - seconds: /10 then: - logger.log: level: INFO format: "%2d %2d %2d %2d" args: - 'uint32_t(id(runtime).state/3600) - uint32_t(id(runtime).state/86400)*1440' - 'uint32_t(id(runtime).state/60) - uint32_t(id(runtime).state/3600)*60' - 'uint32_t(id(runtime).state) - uint32_t(id(runtime).state/60)*60' - 'uint32_t((id(runtime).state - uint32_t(id(runtime).state))*25)' spi: clk_pin: GPIO18 mosi_pin: GPIO19 sensor: - platform: uptime id: runtime update_interval: 100ms display: - platform: spi_74hc595_display cs_pin: GPIO5 data_rate: 1MHz #10MHz num_chips: 1 #3 update_interval: 4s #16ms common_cathode: false segment_first: false reverse: false lambda: |- static uint32_t clock_frames=0; static uint32_t old_clock=0; if(id(sntp_time).now().second!=old_clock){ clock_frames=0; old_clock=id(sntp_time).now().second; } else { clock_frames++; } //it.printf(0, ".*`,_+'-"); it.printf(0, "88888888"); //it.strftime(0, "%H%M%s", id(sntp_time).now()); //it.printf(6, "%2d", clock_frames); //it.strftime(8, "%H%M%s", id(sntp_time).now()); //it.printf(14, "%2d", clock_frames); /*it.strftime(8, "%H%M%s", id(sntp_time).now());*/ /*it.printf(14, "%1d", 0)*/ /*it.printf(16, "%02d%02d%02d%02d", uint32_t(id(runtime).state/3600) - uint32_t(id(runtime).state/86400)*1440, uint32_t(id(runtime).state/60) - uint32_t(id(runtime).state/3600)*60, uint32_t(id(runtime).state) - uint32_t(id(runtime).state/60)*60, uint32_t((id(runtime).state - uint32_t(id(runtime).state))*25) ); */ # the first display should display a test string to figure out the digit and segment map: # digit 0: >.< character (dot segment on) # digit 1: >*< character (A upper segment on) # digit 2: >`< character (B upper right segment on) # digit 3: >,< character (C lower right segment on) # digit 4: >_< character (D lower segment on) # digit 5: >+< character (E lower left segment on) # digit 6: >'< character (F upper left segment on) # digit 7: >-< character (G middle segment on)