From e5109b056f3034cbd1d832a326260eb952b6c10a Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Mon, 20 Jan 2025 21:39:10 +0100 Subject: [PATCH] Move time server IP to secrets Mostly not because it's "secret" but to make templates reusable. --- outdoor-equipment.yaml | 2 ++ recirculation-pump.yaml | 2 ++ templates/nuki.yaml | 3 ++- templates/secrets.yaml.sample | 2 ++ templates/time.yaml | 6 ++++++ 5 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 templates/time.yaml diff --git a/outdoor-equipment.yaml b/outdoor-equipment.yaml index e3e14ca..4220915 100644 --- a/outdoor-equipment.yaml +++ b/outdoor-equipment.yaml @@ -7,9 +7,11 @@ esphome: packages: device_base: !include templates/mystrom.yaml + time: !include templates/time.yaml time: - platform: sntp + id: sntp_time servers: !secret sntp_servers on_time: diff --git a/recirculation-pump.yaml b/recirculation-pump.yaml index bbdfa8a..d88eb12 100644 --- a/recirculation-pump.yaml +++ b/recirculation-pump.yaml @@ -7,9 +7,11 @@ esphome: packages: device_base: !include templates/mystrom.yaml + time: !include templates/time.yaml time: - platform: sntp + id: sntp_time servers: !secret sntp_servers on_time: # Heating schedule is 5AM to 8PM. Judging by the burner state, it means that diff --git a/templates/nuki.yaml b/templates/nuki.yaml index 29ad2bb..c7d3cc9 100644 --- a/templates/nuki.yaml +++ b/templates/nuki.yaml @@ -11,6 +11,7 @@ external_components: packages: device_base: !include esp32-poe.yaml + time: !include time.yaml button: - platform: factory_reset @@ -19,7 +20,7 @@ button: time: - platform: sntp - servers: [eye] + servers: !secret sntp_servers id: sntp_time lock: diff --git a/templates/secrets.yaml.sample b/templates/secrets.yaml.sample index c255e25..3a64de6 100644 --- a/templates/secrets.yaml.sample +++ b/templates/secrets.yaml.sample @@ -7,3 +7,5 @@ lock_pin: 314 wifi_ap_lookup: - "12:34:56:AB:CD -> Upper Floor AP" api_encryption_key: "K3g+SB5OYgLxKtEXhWJd1Mryfy9hGol+mAq+nq/JDsY=" +sntp_servers: +- pool.ntp.org diff --git a/templates/time.yaml b/templates/time.yaml new file mode 100644 index 0000000..bc009be --- /dev/null +++ b/templates/time.yaml @@ -0,0 +1,6 @@ +binary_sensor: +- platform: template + name: "Device clock invalid" + lambda: 'return !id(sntp_time).now().is_valid();' + entity_category: diagnostic + device_class: problem