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

Date color #210

Closed pepe59 closed 6 months ago

pepe59 commented 6 months ago

I don't know if it's a bug but if I set the clock and date color, after 24 hours the time color is correct but the date color goes back to white. I have to call service again and it's fine for another 24 hours.

service: esphome.ulanzi_set_clock_color
data:
  r: 255
  g: 140
  b: 0
lubeda commented 6 months ago

Hi, I think this is no bug. This is more like a hidden automatism. Try changing your YAML like this:

on_empty_queue:
    then:
      - lambda: |-
          id(rgb8x32).set_infotext_color(20,20,20,20,20,20,false,1);
          id(rgb8x32).icon_clock("calendar|day#0",1440,10,false,255,140,0);

So the clock color isn't overwritten by the default color.

pepe59 commented 6 months ago

Yes, the clock color is not overridden by the default color. Date only. I am using the code from the ulanzi-easy.yaml documentation for the Ulanzi TC001 device. If I add your recommended yaml to the end of ulanzi-easy.yaml

  on_next_screen:
    - homeassistant.event:
        event: esphome.new_screen
        data_template:
          iconname: !lambda "return icon.c_str();"
          text: !lambda "return text.c_str();"

  on_empty_queue:
    then:
      - lambda: |-
          id(rgb8x32).set_infotext_color(20,20,20,20,20,20,false,1);
          id(rgb8x32).icon_clock("calendar|day#0",1440,10,false,255,140,0);

an error occurs in the code [on_empty_queue] is an invalid option for [ehmtxv2]. Did you mean [allow_empty_screen]?

andrewjswan commented 6 months ago

an error occurs in the code

EspHoMaTriXv2 version?

pepe59 commented 6 months ago

Installed as per documentation

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EspHoMaTriXv2
      ref: main
    refresh: 60s 
    components: [ ehmtxv2 ]   

esphome:
  comment: "EHMTXv2 from LuBeDa"
  name: $devicename 
  project:
    name: "Ulanzi.EHMTXv2"
    version: "2.0.0"
  on_boot:
    then:
      - ds1307.read_time:
andrewjswan commented 6 months ago

on_empty_queue added in 2023.8.0 - https://github.com/lubeda/EspHoMaTriXv2/tree/2023.8.0?tab=readme-ov-file#esphomatrix-202380 Try Pre Release version - https://github.com/lubeda/EspHoMaTriXv2/tree/2024.1.0-prerelease

pepe59 commented 6 months ago

I installed the pre version

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EspHoMaTriXv2
      ref: "2024.1.0"
    refresh: 600s 
    components: [ ehmtxv2 ]

The first thing that appears is the calendar icon (I don't know how to remove it or change it to another one. I don't like it very much). Hours and days of the week are displayed. The hours do not alternate with the date. It's still just a static clock. That's why I can't tell if the color of the date will change after 24 hours.

  on_empty_queue:
      then:
        - lambda: |-
            id(rgb8x32).set_infotext_color(20,20,20,20,20,20,false,1);
            id(rgb8x32).icon_clock("calendar|day#0",1440,10,false,255,140,0);

log

[20:59:35][I][EHMTXv2:2146]: set_brightness 41 => 16.08 %
[20:59:36][D][EHMTXv2:938]: oldest queue element is: 0/1
[20:59:36][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec
[20:59:37][D][sht3xd:064]: Got temperature=33.44°C humidity=23.81%
[20:59:37][D][sensor:094]: 'ulanzi Teplota': Sending state 33.43557 °C with 1 decimals of accuracy
[20:59:37][D][sensor:094]: 'ulanzi Vlhkost': Sending state 23.80560 % with 1 decimals of accuracy
[20:59:45][D][sensor:094]: 'ulanzi Luxmetr': Sending state 124.64687 lx with 0 decimals of accuracy
[20:59:46][D][EHMTXv2:938]: oldest queue element is: 0/1
[20:59:46][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec
[20:59:55][D][sensor:094]: 'ulanzi Luxmetr': Sending state 124.83978 lx with 0 decimals of accuracy
[20:59:56][D][EHMTXv2:938]: oldest queue element is: 0/1
[20:59:56][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec
pepe59 commented 6 months ago

Can I find sample code somewhere for the Ulanzi screen where it's just the clock alternating with the date and days of the week like it was in previous versions ?

andrewjswan commented 6 months ago

What was in the previous version? Everything that was available in the old version is available here.

andrewjswan commented 6 months ago

I don't know how to remove it or change it to another one. I don't like it very much

Only clock with icon:

  on_start_running:
     then:
       lambda: |-
          id(rgb8x32)->icon_clock("another_one_icon", 1440, 10, false, 255, 140, 0);

  on_empty_queue:
    then:
      lambda: |-
          id(rgb8x32)->icon_clock("another_one_icon", 1440, 10, false, 255, 140, 0);

Clock and Date with icon:

  on_start_running:
     then:
       lambda: |-
          id(rgb8x32)->icon_clock("another_one_icon", 1440, 10, false, 255, 140, 0);
          id(rgb8x32)->icon_date("another_one_icon", 1440, 5, true, 255, 140, 0);

  on_empty_queue:
    then:
      lambda: |-
          id(rgb8x32)->icon_clock("another_one_icon", 1440, 10, false, 255, 140, 0);
          id(rgb8x32)->icon_date("another_one_icon", 1440, 5, true, 255, 140, 0);

Or without icon:

  on_start_running:
     then:
       lambda: |-
          id(rgb8x32)->clock_screen(1440,10, false, 255, 140, 0);
          id(rgb8x32)->date_screen(1440,5,true, 255, 140, 0);

  on_empty_queue:
    then:
      lambda: |-
          id(rgb8x32)->clock_screen(1440,10, false, 255, 140, 0);
          id(rgb8x32)->date_screen(1440,5,true, 255, 140, 0);

That's why I can't tell if the color of the date will change after 24 hours.

id(rgb8x32)->set_clock_color(255, 0, 0); // Red color
id(rgb8x32)->set_clock_color(0, 255, 0); // Green color
id(rgb8x32)->set_clock_color(0, 0, 255); // Blue color
pepe59 commented 6 months ago

Thank you very much. I wandered a bit in the documentation. Using sample codes, I now understood how to configure. Everything works perfectly. I will close the issue.