From 0947526127624f7922f47720cf01a1201630a7e6 Mon Sep 17 00:00:00 2001 From: tbratfisch Date: Fri, 13 Oct 2023 19:53:09 +0200 Subject: [PATCH] Update special-clock-and-date-display-duration.md Adding a description how to do it easier with a lambda --- ...special-clock-and-date-display-duration.md | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/wiki/special-clock-and-date-display-duration.md b/wiki/special-clock-and-date-display-duration.md index 311a90f5..c0c2ccf3 100644 --- a/wiki/special-clock-and-date-display-duration.md +++ b/wiki/special-clock-and-date-display-duration.md @@ -1,14 +1,32 @@ # Introduction -**Skill-level:** easy +I'm using EspHoMaTriXv2 on a Ulanzi TC001. I want to display the time for 55 seconds and the date for 5 seconds in a loop. I don't understand, how I can configure the display times. I tried clock_interval: 55 but it doesn't seem to help. -Set up a timer helper named *eier_timer* +What's the correct way? -## step 1: **home assistant automation:** +## new Method with lambda: -I'm using EspHoMaTriXv2 on a Ulanzi TC001. I want to display the time for 55 seconds and the date for 5 seconds in a loop. I don't understand, how I can configure the display times. I tried clock_interval: 55 but it doesn't seem to help. +add this to your config: + +```yaml + on_start_running: + then: + lambda: |- + ESP_LOGD(TAG, "removing date screen and setting a new one with new screen time"); + id(rgb8x32)->del_screen("*", 3); + id(rgb8x32)->date_screen(1440, 5, true, 192, 192, 192); + ESP_LOGD(TAG, "removing default clock screen and setting a new one with new screen time"); + id(rgb8x32)->del_screen("*", 2); + id(rgb8x32)->clock_screen(1440, 55, true, 192, 192, 192); +``` + +## old Method: + +**Skill-level:** easy + +Set up a timer helper named *eier_timer* -What's the corerct way? +### step 1: **home assistant automation:** I think the easiest way is by a home assistant script like this: @@ -45,4 +63,4 @@ icon: mdi:clock-digital This deletes the default date and clock display and fills the loop with a 55 sec clock and a 5 sec date screen. The lifetime is one day, so the script must run once a day or on boot. -This is also possible in the esphome YAML, with lambdas. \ No newline at end of file +This is also possible in the esphome YAML, with lambdas.