From 6a3afd71df22433f06ae514c69e77ca5d6b33f1c Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Wed, 29 Jul 2026 21:20:17 +0200 Subject: [PATCH] Display Current Time via SNTP --- esphome/energymonitor.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/esphome/energymonitor.yaml b/esphome/energymonitor.yaml index fafde96..9302551 100644 --- a/esphome/energymonitor.yaml +++ b/esphome/energymonitor.yaml @@ -41,6 +41,13 @@ wifi: captive_portal: +time: + - platform: sntp + id: sntp_time + timezone: Europe/Berlin + servers: + - de.pool.ntp.org + logger: api: @@ -100,6 +107,13 @@ display: lambda: |- it.fill(Color::BLACK); + if (id(sntp_time).now().is_valid()) { + it.strftime(284, 10, id(font_small), Color::WHITE, TextAlign::TOP_RIGHT, + "%H:%M", id(sntp_time).now()); + } else { + it.printf(284, 10, id(font_small), Color::WHITE, TextAlign::TOP_RIGHT, "--:--"); + } + // Four bars show RSSI quality; a crossed outline means Wi-Fi is disconnected. if (id(wifi_connected)) { int bars = 1;