lubeda / EspHoMaTriXv2

A simple DIY status display with a 8x32 RGB LED matrix, implemented with esphome.io and Home Assistant.
MIT License
269 stars 25 forks source link

2024.1.0: Advanced clock - draw date #197

Closed andrewjswan closed 7 months ago

andrewjswan commented 7 months ago

In advanced clock mode, the date separator will be displayed with the color of the clock separator.

lubeda commented 7 months ago

While testing this PR, I found a bug. With advanced_clock: true the set_infotext_color isn't working anymore.

There is also the question: Why we need advanced_clock. This feature could be standard.

andrewjswan commented 7 months ago

There is also the question: Why we need advanced_clock. This feature could be standard.

I'm not against making it standard, but maybe it's not necessary for everyone, well, and adds a load, though not a big one.

With advanced_clock: true the set_infotext_color isn't working anymore.

I probably forgot to write this, but in advanced clock mode, set_infotext_color works for the date screen, set_clock_infotext_color works for the clock screen.

So adds the ability to have different colors on the date screen and the clock screen.

If making this extended clock feature the default (standard), then maybe that needs to be revised.

andrewjswan commented 7 months ago

Also I think whether it is necessary to add a separate color for the number and month in the date, or one color for the date and the color for the separator from the clock will be enough.

andrewjswan commented 7 months ago

I checked with myself, the change works. You can inject into the main branch, and then reformat to make this functionality the default working one.

andrewjswan commented 7 months ago

I wanted to add that the numbers change by vertical scrolling as in flip flop clock, but I have not yet figured out how to catch the time of the beginning of the digit change, and how to do it nicely. :)

andrewjswan commented 7 months ago

This is my current work config:

ehmtxv2:
  id: rgb8x32
  icons2html: true
  iconscache: true
  matrix_component: ehmtx_display
  time_component: ehmtx_time
  time_format: "%H:%M"
  time_format_big: "%H:%M:%S"
  date_format: "%d•%m"
  date_format_big: "%a•%d•%b"
  weekdays: "일월화수목금토"
  replace_time_date_from: "Sun Mon Tue Wed Thu Fri Sat Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
  replace_time_date_to:   "ВС ПН ВТ СР ЧТ ПТ СБ Січ Лют Бер Кві Тра Чер Лип Сер Вер Жов Лис Гру"
  default_font_id: default_font
  default_font_yoffset: 7
  special_font_id: special_font
  special_font_yoffset: 8
  blend_steps: 32
  show_seconds: false
  advanced_clock: true
  advanced_bitmap: true
  boot_logo: "[0,...,0]"
  boot_logo_mode: 7

...

  on_start_running:
    then:
      lambda: |-
        id(rgb8x32)->expand_icon_to_9(3);

        id(rgb8x32)->set_clock_infotext_color(200,200,200, 200,200,200, true, 0);
        id(rgb8x32)->set_adv_clock_color(0,0,0, 0,0,0, 150,150,150);
        id(rgb8x32)->icon_clock("blank|day#2", 1440, 10, true);

        id(rgb8x32)->set_date_infotext_color(0,150,240, 0,150,240, false, 1);
        id(rgb8x32)->icon_date("blank|weekday", 1440, 5, true);

        id(rgb8x32)->show_icon_indicator(240,240,240, 7, 7, 1);
        id(rgb8x32)->set_weekday_accent_on();