Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I`m preparing a release #190

Open
lubeda opened this issue Dec 30, 2023 · 66 comments
Open

I`m preparing a release #190

lubeda opened this issue Dec 30, 2023 · 66 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@lubeda
Copy link
Owner

lubeda commented Dec 30, 2023

Hi there,
in the last time there were so many new features added (thanx @andrewjswan a) that it is now necessary to restructure the repo, clean it up and make the documentation easier to read and understand. I'm preparing it in the 2024.1.0-prerelease branch.

So stay calm, until the new release (with no new features), I suggest using the 2023.9.1 branch.

See you soon.

@lubeda lubeda added help wanted Extra attention is needed question Further information is requested labels Dec 30, 2023
@trip5
Copy link
Contributor

trip5 commented Dec 30, 2023

Happy New Year Lubeda!

@andrewjswan
Copy link

Happy New Year!

@fthiery
Copy link

fthiery commented Jan 21, 2024

Hi, I'm testing the pre release and the text supposed to be the date over the calendar icon is just a blinking exclamation mark. Is this issue the right place to report bugs ?

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

This is bug in your YAML. Somehow the display gets no time. Check your configuration and the log

@fthiery
Copy link

fthiery commented Jan 21, 2024

I double checked (md5sum) and the ulanzi-easy.yaml file is 100% identical to the one from the install/ folder of this repo (i did create a secrets.yaml file containing the ota and wifi passwords -- you may want to update this in the Readme btw, because it still suggests editing the ulanzi-easy.yaml file directly).

Plus, i DO get the time (just not the day):
image

Logs:

INFO ESPHome 2023.12.8
INFO Reading configuration /config/esphome/ulanzi-easy.yaml...
INFO Updating https://github.com/lubeda/EspHoMaTriXv2@2024.1.0
WARNING 
WARNING !!!!This version (2023.9.1) has breaking changes!!!!
WARNING Please check the documentation and wiki https://github.com/lubeda/EspHoMaTriXv2
WARNING This will only work with esphome >= 2023.7.0
WARNING 
WARNING GPIO15 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Detected timezone 'Europe/Paris'
INFO Detected timezone 'Europe/Paris'
INFO Starting log output from 192.168.1.81 using esphome API
INFO Successfully connected to ulanzi @ 192.168.1.81 in 0.200s
INFO Successful handshake with ulanzi @ 192.168.1.81 in 0.048s

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

Can you edit the log-level to debug a post a new log?

logger:
  level: DEBUG

I tried it on two devices, and it works for me. We have to investigate a bit.

can you also provide this part of your config?

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

@fthiery
Copy link

fthiery commented Jan 21, 2024

Here is the DEBUG log:

[12:49:40][I][app:102]: ESPHome version 2023.12.8 compiled on Jan 21 2024, 12:42:29
[12:49:40][I][app:104]: Project Ulanzi.EHMTXv2 version 2024.1.0
[12:49:40][C][wifi:573]: WiFi:
[12:49:40][C][wifi:405]:   Local MAC: xxxxxxxxxxxx
[12:49:40][C][wifi:410]:   SSID: [redacted]
[12:49:40][C][wifi:411]:   IP Address: 192.168.1.81
[12:49:40][C][wifi:413]:   BSSID: [redacted]
[12:49:40][C][wifi:414]:   Hostname: 'ulanzi'
[12:49:40][C][wifi:416]:   Signal strength: -13 dB ▂▄▆█
[12:49:40][C][wifi:420]:   Channel: 11
[12:49:40][C][wifi:421]:   Subnet: 255.255.255.0
[12:49:40][C][wifi:422]:   Gateway: 192.168.1.254
[12:49:40][C][wifi:423]:   DNS1: 192.168.1.3
[12:49:40][C][wifi:424]:   DNS2: 192.168.1.254
[12:49:40][C][logger:439]: Logger:
[12:49:40][C][logger:440]:   Level: DEBUG
[12:49:40][C][logger:441]:   Log Baud Rate: 115200
[12:49:40][C][logger:443]:   Hardware UART: UART0
[12:49:40][C][i2c.arduino:053]: I2C Bus:
[12:49:40][C][i2c.arduino:054]:   SDA Pin: GPIO21
[12:49:40][C][i2c.arduino:055]:   SCL Pin: GPIO22
[12:49:40][C][i2c.arduino:056]:   Frequency: 50000 Hz
[12:49:40][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[12:49:40][I][i2c.arduino:069]: Results from i2c bus scan:
[12:49:40][I][i2c.arduino:075]: Found i2c device at address 0x44
[12:49:40][I][i2c.arduino:075]: Found i2c device at address 0x68
[12:49:40][C][ledc.output:166]:   LEDC Channel: 0
[12:49:40][C][ledc.output:167]:   PWM Frequency: 1000.0 Hz
[12:49:40][C][ledc.output:168]:   Bit depth: 16
[12:49:40][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Left button'
[12:49:40][C][gpio.binary_sensor:016]:   Pin: GPIO26
[12:49:40][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Middle button'
[12:49:40][C][gpio.binary_sensor:016]:   Pin: GPIO27
[12:49:40][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Right button'
[12:49:40][C][gpio.binary_sensor:016]:   Pin: GPIO14
[12:49:40][C][light:103]: Light 'ulanzi Light'
[12:49:40][C][light:105]:   Default Transition Length: 1.0s
[12:49:40][C][light:106]:   Gamma Correct: 2.00
[12:49:40][C][template.switch:068]: Template Switch 'Auto-Adjust Brightness'
[12:49:40][C][template.switch:070]:   Icon: 'mdi:brightness-auto'
[12:49:40][C][template.switch:091]:   Restore Mode: restore defaults to ON
[12:49:40][C][template.switch:057]:   Optimistic: NO
[12:49:40][C][rtttl:029]: Rtttl
[12:49:40][C][status:034]: Status Binary Sensor 'ulanzi Status'
[12:49:40][C][status:034]:   Device Class: 'connectivity'
[12:49:40][C][sht3xd:033]: SHT3xD:
[12:49:40][C][sht3xd:034]:   Address: 0x44
[12:49:40][C][sht3xd:038]:   Update Interval: 60.0s
[12:49:40][C][sht3xd:040]:   Temperature 'ulanzi Temperature'
[12:49:40][C][sht3xd:040]:     Device Class: 'temperature'
[12:49:40][C][sht3xd:040]:     State Class: 'measurement'
[12:49:40][C][sht3xd:040]:     Unit of Measurement: '°C'
[12:49:40][C][sht3xd:040]:     Accuracy Decimals: 1
[12:49:40][C][sht3xd:041]:   Humidity 'ulanzi Relative Humidity'
[12:49:40][C][sht3xd:041]:     Device Class: 'humidity'
[12:49:40][C][sht3xd:041]:     State Class: 'measurement'
[12:49:40][C][adc:097]:   State Class: 'measurement'
[12:49:40][C][adc:097]:   State Class: 'measurement'
[12:49:40][C][adc:097]:   Unit of Measurement: 'lx'
[12:49:40][C][adc:097]:   Accuracy Decimals: 0
[12:49:40][C][adc:107]:   Pin: GPIO35
[12:49:40][C][adc:109]:  Attenuation: auto
[12:49:40][C][adc:142]:   Update Interval: 10.0s
[12:49:40][C][ds1307:022]: DS1307:
[12:49:40][C][ds1307:023]:   Address: 0x68
[12:49:40][C][ds1307:027]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[12:49:40][C][homeassistant.time:010]: Home Assistant Time:
[12:49:40][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[12:49:40][C][web_server:168]: Web Server:
[12:49:40][C][web_server:169]:   Address: ulanzi.local:80
[12:49:40][C][mdns:115]: mDNS:
[12:49:40][C][mdns:116]:   Hostname: ulanzi
[12:49:40][C][ota:097]: Over-The-Air Updates:
[12:49:40][C][ota:098]:   Address: ulanzi.local:3232
[12:49:40][C][ota:101]:   Using Password.
[12:49:40][C][api:139]: API Server:
[12:49:40][C][api:140]:   Address: ulanzi.local:6053
[12:49:40][C][api:144]:   Using noise encryption: NO
[12:49:40][C][EHMTXv2:2487]: EspHoMatriXv2 version: 2024.1.1
[12:49:40][C][EHMTXv2:2488]: Icons: 28 of 90
[12:49:40][C][EHMTXv2:2489]: Clock interval: 0 s
[12:49:40][C][EHMTXv2:2490]: Date format: %d.%m.
[12:49:40][C][EHMTXv2:2491]: Time format: %H:%M
[12:49:40][C][EHMTXv2:2492]: Interval (ms) scroll: 80
[12:49:40][C][EHMTXv2:2495]: Show day of week
[12:49:40][C][EHMTXv2:2503]: Weekstart: Monday
[12:49:40][C][EHMTXv2:2504]: Weekdays: SOMODIMIDOFRSA Count: 14
[12:49:40][C][EHMTXv2:2505]: Display: On
[12:49:40][C][EHMTXv2:2506]: Night mode: Off
[12:49:40][C][EHMTXv2:2507]: Weekday accent: Off
[12:49:40][C][EHMTXv2:2508]: Replace Time and Date: Off
[12:49:43][D][EHMTXv2:938]: oldest queue element is: 0/1
[12:49:43][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec
[12:49:45][D][sensor:094]: 'ulanzi Illuminance': Sending state 377.93787 lx with 0 decimals of accuracy
[12:49:51][D][api:102]: Accepted 192.168.1.3
[12:49:51][D][api.connection:1121]: Home Assistant 2024.1.5 (192.168.1.3): Connected successfully
[12:49:51][D][time:045]: Synchronized time: 2024-01-21 12:49:51
[12:49:51][D][ds1307:101]: Write 11:49:51 2024-01-21  CH:OFF RS:3 SQWE:OFF OUT:OFF
[12:49:53][D][EHMTXv2:938]: oldest queue element is: 0/1
[12:49:53][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec
[12:49:55][D][sensor:094]: 'ulanzi Illuminance': Sending state 375.73999 lx with 0 decimals of accuracy

As i said, i did not touch the yaml file, so the external_components part is:

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

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

OK,
one thing you have to transtlate the weekdays from german to french , just add the weekdays line to your config.

ehmtxv2: 
  weekdays: "DiLuMaMeJeVeSa"

And please try again.

@fthiery
Copy link

fthiery commented Jan 21, 2024

Thanks for the suggestion, which i tried; no change unfortunately:

[13:09:58][C][ds1307:027]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[13:09:59][C][homeassistant.time:010]: Home Assistant Time:
[13:09:59][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
...
[13:09:59][C][EHMTXv2:2487]: EspHoMatriXv2 version: 2024.1.1
[13:09:59][C][EHMTXv2:2488]: Icons: 28 of 90
[13:09:59][C][EHMTXv2:2489]: Clock interval: 0 s
[13:09:59][C][EHMTXv2:2490]: Date format: %d.%m.
[13:09:59][C][EHMTXv2:2491]: Time format: %H:%M
[13:09:59][C][EHMTXv2:2492]: Interval (ms) scroll: 80
[13:09:59][C][EHMTXv2:2495]: Show day of week
[13:09:59][C][EHMTXv2:2503]: Weekstart: Monday
[13:09:59][C][EHMTXv2:2504]: Weekdays: DiLuMaMeJeVeSa Count: 14
[13:09:59][C][EHMTXv2:2505]: Display: On
[13:09:59][C][EHMTXv2:2506]: Night mode: Off
[13:09:59][C][EHMTXv2:2507]: Weekday accent: Off
[13:09:59][C][EHMTXv2:2508]: Replace Time and Date: Off
[13:09:59][D][sensor:094]: 'ulanzi Illuminance': Sending state 508.61026 lx with 0 decimals of accuracy
[13:09:59][I][EHMTXv2:2146]: set_brightness 137 => 53.73 %
[13:10:01][D][api:102]: Accepted 192.168.1.3
[13:10:01][D][api.connection:1121]: Home Assistant 2024.1.5 (192.168.1.3): Connected successfully
[13:10:01][D][time:045]: Synchronized time: 2024-01-21 13:10:01
[13:10:01][D][ds1307:101]: Write 12:10:01 2024-01-21  CH:OFF RS:3 SQWE:OFF OUT:OFF
[13:10:08][D][EHMTXv2:938]: oldest queue element is: 0/1
[13:10:08][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec

image

Here is the diff between my device's ulanzi-easy.yaml and install/ulanzi-easy.yaml:

diff --git a/install/ulanzi-easy.yaml b/install/ulanzi-easy.yaml
index e42838d..db2b3e3 100644
--- a/install/ulanzi-easy.yaml
+++ b/install/ulanzi-easy.yaml
@@ -105,7 +105,9 @@ binary_sensor:
     name: "Right button"
 
 logger:
-  level: WARN
+  #level: WARN
+  level: DEBUG
+
 
 api:
   services:
@@ -231,6 +233,7 @@ ehmtxv2:
   time_component: ehmtx_time
   time_format: "%H:%M"
   date_format: "%d.%m."
+  weekdays: "DiLuMaMeJeVeSa"
   show_seconds: false
   default_font_id: px6_font
   default_font_yoffset: 7

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

Now i have the same bug! I think you have to use 2023.9.1 until i found the problem.

désolé ;-) I like spending my holiday time in France, mostly in the Bretagne and Normandy.

@fthiery
Copy link

fthiery commented Jan 21, 2024

Oh, strange that you did not reproduce 1 hour ago... But i'm glad you do now. No problem i can wait ! Vielen Dank ;)

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

strange

The icon name in the sample was wrong:

This will work:

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);

@fthiery
Copy link

fthiery commented Jan 21, 2024

Great, that did it, it works now, many thanks !!!

I'm not sure it is intentional but you commited the DEBUG level.

Maybe another, issue, the get_status service call seems to do nothing for me (i open the log in esphome, then run the get_status service within HA -- i expect to see the status in the esphome logs, but i see nothing; what am i missing ?)

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

Hi, DEBUG level helps me if there are issues, for normal use it isn't necessary. The get_status service should write details to the ESP-log with the level INFO, so now you should see something in your log.

@fthiery
Copy link

fthiery commented Jan 21, 2024

You are talking about the log that is viewed by clicking here, right ?

Capture d’écran du 2024-01-21 15-57-00

Then i call the service

image

But nothing:

image

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

Again, strange. I will investigate....

@fthiery
Copy link

fthiery commented Jan 21, 2024

Actually, in DEBUG i see the status (i guess):

[19:36:24][I][EHMTXv2:1314]: status time: 21.1.2024 19:36
[19:36:24][I][EHMTXv2:1315]: status brightness: 61 (0..255)
[19:36:24][I][EHMTXv2:1316]: status date format: %d.%m.
[19:36:24][I][EHMTXv2:1317]: screen_pointer: 0
[19:36:24][I][EHMTXv2:1319]: current screen mode: 15
[19:36:24][I][EHMTXv2:1323]: status time format: %H:%M
[19:36:24][I][EHMTXv2:1324]: status date format: %d.%m.
[19:36:24][I][EHMTXv2:1325]: status display on
[19:36:24][I][EHMTXv2:1326]: status night mode off
[19:36:24][I][EHMTXv2:1327]: status weekday accent off
[19:36:24][I][EHMTXv2:1328]: status replace time and date off
[19:36:24][D][EHMTXv2:128]: queue: icon clock: "day#0" for: 10.0 sec
[19:36:24][I][EHMTXv2:1344]: queue: 23 empty slots
[19:36:24][W][component:214]: Component api took a long time for an operation (0.06 s).
[19:36:24][W][component:215]: Components should block for at most 20-30ms.

Is this expected (if so the readme should maybe mention it)?

@lubeda
Copy link
Owner Author

lubeda commented Jan 21, 2024

Yes, that is the expected result.

@fthiery
Copy link

fthiery commented Jan 22, 2024

Ok, got confused because the default install yaml was WARN (hiding the get_status log). I can contribute improvements to the readme, should I open a PR for it ?

@lubeda
Copy link
Owner Author

lubeda commented Jan 22, 2024

Sure, every PR is welcome.

@fthiery
Copy link

fthiery commented Jan 22, 2024

Done, i hope you'll like my changes !
#202

@popy2k14
Copy link

Hi. Testing now the pre-release and have a question about the night mode.

Looked at the code and saw that when night mode is on all screens are skipped which are not flagged as night mode.

How can I specify just "clock" as night mode screen and apply a color?

@popy2k14
Copy link

Got it, there is night_mode_screens like so:

ehmtxv2: 
  night_mode_screens: [2]

Experimenting now.

@popy2k14
Copy link

popy2k14 commented Jan 29, 2024

Working as expected, but how to correctly use the trigger?

This doesn't work:

ehmtxv2: 
  on_night_mode:
    then:
      lambda: |-
        id(rgb8x32)->set_clock_color(235, 0, 0);

@andrewjswan
Copy link

Working as expected, but how to correctly use the trigger?

You need to turn on the night mode night_mode_on, and this trigger should work.

@popy2k14
Copy link

popy2k14 commented Jan 30, 2024

You need to turn on the night mode night_mode_on, and this trigger should work.

I'll switched it on (tested with a switch and the exported service). Tested in 2023.9.1 and 2024.1.0-prerelease branches.

My definition:

  id: rgb8x32
  icons2html: true
  matrix_component: ehmtx_display
  time_component: ehmtx_time
  time_format: "%H:%M"
  date_format: "%d.%m"
  show_seconds: false
  # Uncomment below if using the mateine font
  default_font_id: default_font
  special_font_id: default_font
  default_font_yoffset: 8
  special_font_yoffset: 8  
  # Comment out below if using mateine font
  #default_font_id: default_font
  #default_font_yoffset: 8
  #special_font_id: special_font
  #special_font_yoffset: 6
  # until here
  #boot_logo: "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,63519,63519,63519,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,0,0,0,0,2016,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,63488,0,63488,0,0,0,63519,0,0,0,0,2016,2016,0,0,0,65514,0,65514,0,0,0,31,0,0,0,64512,0,0,64512,0,63488,63488,0,63488,63488,0,0,63519,63519,63519,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,31,31,31,0,0,0,64512,64512,0,0,63488,63488,63488,63488,63488,0,0,63519,0,0,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,31,0,0,0,0,64512,64512,0,0,0,63488,63488,63488,0,0,0,63519,63519,63519,63519,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,0,31,31,0,64512,0,0,64512,0,0,0,63488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"

  clock_interval: 20      # show the clock at least each x seconds
  show_dow: false         # draw the day indicator on the bottom of the screen, defaults to true
  #show_date: true         # show the date for show_screen - show_clock seconds otherwise only shows the clock for show_screen seconds, defaults to true
  week_start_monday: true # default monday is first day of week, false = sunday
  night_mode_screens: [2]
  icons:
    - id: ha
      lameid: 7956
    - id: tempc
      lameid: 2422
    - id: plug
      lameid: 403
    - id: humidity
      lameid: 51764
    - id: co2
      lameid: 30662
    - id: weather_clear_night
      lameid: 53383
    - id: weather_cloudy
      lameid: 53384
    - id: weather_fog
      lameid: 12196  
    - id: weather_hail
      lameid: 53385  
    - id: weather_lightning
      lameid: 50231  
    - id: weather_lightning_rainy
      lameid: 49299  
    - id: weather_partlycloudy
      lameid: 53802  
    - id: weather_pouring
      lameid: 49300  
    - id: weather_rainy
      lameid: 2284  
    - id: weather_snowy
      lameid: 2289  
    - id: weather_snowy_rainy
      lameid: 49301  
    - id: weather_sunny
      lameid: 1246
    - id: weather_windy
      lameid: 17076  
    - id: weather_windy_variant
      lameid: 15618  
    - id: weather_exceptional
      lameid: 5464    
    - id: washing_machine_ready
      lameid: 26673
    - id: dryer_ready
      lameid: 48497
    - id: dishwasher_ready
      lameid: 47488
    - id: door_ringing
      lameid: 24800
    - id: fire
      lameid: 24873
    - id: water
      lameid: 24116
  on_empty_queue:
    then:
      lambda: |-
        id(rgb8x32)->clock_screen(10,10);
        id(rgb8x32)->date_screen(10,5);
  on_start_running:
     then:
       lambda: |-
          id(rgb8x32)->bitmap_screen("[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,63519,63519,63519,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,0,0,0,0,2016,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,63488,0,63488,0,0,0,63519,0,0,0,0,2016,2016,0,0,0,65514,0,65514,0,0,0,31,0,0,0,64512,0,0,64512,0,63488,63488,0,63488,63488,0,0,63519,63519,63519,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,31,31,31,0,0,0,64512,64512,0,0,63488,63488,63488,63488,63488,0,0,63519,0,0,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,31,0,0,0,0,64512,64512,0,0,0,63488,63488,63488,0,0,0,63519,63519,63519,63519,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,0,31,31,0,64512,0,0,64512,0,0,0,63488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",1,10);
          id(rgb8x32)->bitmap_small("[2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,0,2016,0,2016,0,31,31,0,0,0,2016,0,31,0,0,31,0,0,0,0,0,0,31,0,0,0,0,0,0,31,0,0,0,0,0,0,31,31,31,31]", "2023.x.y", 1, 10);
          id(rgb8x32)->clock_screen(10,10);
          id(rgb8x32)->date_screen(10,5);
  on_next_screen:
    - homeassistant.event:
        event: esphome.new_screen
        data_template:
          iconname: !lambda "return icon.c_str();"
          text: !lambda "return text.c_str();"
  on_night_mode:
    then:
      lambda: |-
        //if (x) {
            id(rgb8x32)->set_clock_color(235, 0, 0);
        //} else {
            //id(rgb8x32)->set_clock_color(255, 255, 255);
        //}

The switch:

  - platform: template

    name: "Night mode"
    id: switch_night_mode
    icon: mdi:sleep
    restore_mode: RESTORE_DEFAULT_OFF
    lambda: |-
      if (id(night_enable)) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      lambda: |-
        id(night_enable) = true;
        id(aab_enable) = false;
        id(rgb8x32)->set_night_mode_on();
        id(rgb8x32)->set_brightness(30);
        //id(rgb8x32)->set_clock_color(235, 0, 0);         
    turn_off_action:
      lambda: |-
        id(night_enable) = false;  
        id(aab_enable) = true;
        id(rgb8x32)->set_night_mode_off();
        //id(rgb8x32)->set_clock_color(255, 255, 255);

I can see that nightmode is enabled in the logs and also just the night_mode_screens are showed.

But the trigger is not called

When I uncomment the set_clock_color in the switch, it's working but I want my customizations on the callback, for a cleaner for

Thx

@andrewjswan
Copy link

But the trigger is not called

I checked everything, it should work. What if we add a little feedback?

  on_night_mode:
    then:
      lambda: |-
        ESP_LOGE("night", "night mode badabum");
        id(rgb8x32)->set_clock_color(235, 0, 0);

@andrewjswan
Copy link

I think this switch can be simplified a little and one global variable removed.

  - platform: template

    name: "Night mode"
    id: switch_night_mode
    icon: mdi:sleep
    restore_mode: RESTORE_DEFAULT_OFF
    lambda: |-
        return id(rgb8x32)->night_mode;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_night_mode_on();
        id(aab_enable) = !id(rgb8x32)->night_mode;
        id(rgb8x32)->set_brightness(30);
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_night_mode_off();
        id(aab_enable) = !id(rgb8x32)->night_mode;

@andrewjswan
Copy link

andrewjswan commented Jan 31, 2024

Yes

Those the changes #205 didn't help?
True, they are not yet in the 2024.1.0 branch, I think you need to check with this configuration.

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

@popy2k14
Copy link

Sorry, I meant I tried my own fotk hack version, which did not work.

Tried now your branch and "badabum" 😊
It's working now, thx.

[10:53:51][D][switch:012]: 'Night mode' Turning ON.
[10:53:51][D][EHMTXv2:176]: night mode on
[10:53:51][E][night:186]: night mode badabum
[10:53:51][D][EHMTXv2:878]: default clock color r: 235 g: 0 b: 0
[10:53:51][I][EHMTXv2:2304]: set_brightness 30 => 11.76 %
[10:53:51][D][switch:055]: 'Auto-Adjust Brightness': Sending state OFF
[10:53:51][D][switch:055]: 'Night mode': Sending state ON
[10:53:52][D][number:012]: 'Brightness': Sending state 31.000000

@andrewjswan
Copy link

It's working now, thx.

Waiting for @lubeda to merge this PR to the 2024.1.0 branch.

@andrewjswan
Copy link

It's working now, thx.

Merged ...

@popy2k14
Copy link

I have now set screenmode 2 (clock) as night_mode_screens, it's working as expected.
On migration my HA automations from 2023.7.1, i stumbled accross my fire, water & ringing alarm icon_screens.

When night mode is on, they dont show up now (also with force_screen), which isn't that great.

Any chance to get a force_screen flag to temorarily override night_mode_screens and show the forced screen?

thx

@popy2k14
Copy link

Another thing.
I was updating my clock constantly OTA the last days without an issue.
Since i switched 2024.1.0, sometimes it doesn't come up and is dead.
I have to reflash it over serial to get it working again.

@andrewjswan
Copy link

When night mode is on, they dont show up now (also with force_screen), which isn't that great.

Change:

night_mode_screens: [2]

to

night_mode_screens: [2,5]

or to

night_mode_screens: [2,16]

and use alert_screen {"icon_name","text", "screen_time", "default_font", "r", "g", "b"}

@andrewjswan
Copy link

Since i switched 2024.1.0, sometimes it doesn't come up and is dead.

When I debug code, I often modify it using OTA, this has never happened before.

@popy2k14
Copy link

popy2k14 commented Jan 31, 2024

or to

night_mode_screens: [2,16]

and use alert_screen {"icon_name","text", "screen_time", "default_font", "r", "g", "b"}

Thx using alert_screen now because I can seperate important alerts and not.

@popy2k14
Copy link

Since i switched 2024.1.0, sometimes it doesn't come up and is dead.

When I debug code, I often modify it using OTA, this has never happened before.

Yeah, I think an issue with the hardware...

@andrewjswan
Copy link

Thx using alert_screen now because I can seperaten of important alerts and not.

night_mode_screens: [2, 5, 16] ?

@popy2k14
Copy link

popy2k14 commented Jan 31, 2024

All good regarding the night_mode_screens :-)

A question regarding the function:

clock_screen(int lifetime, int screen_time, bool default_font, int r, int g, int b)

I have this in my config, because otherwise no clock is shown. That changed on newer releases.

on_empty_queue:

    then:
      lambda: |-
        id(rgb8x32)->clock_screen(10,10);
        id(rgb8x32)->date_screen(10,5);
  on_start_running:
     then:
       lambda: |-
          id(rgb8x32)->clock_screen(10,10);
          id(rgb8x32)->date_screen(10,5);

I noticed after some time the clock and date is gone.

Sure 😁 lifetime is set to 10 minutes and other screens (weather, ...) are long time queued.
So queue is not empty and no clock is shown.

Can lifetime be set to "always show clock&date" (infinity)?

Or do I have to use esphome timers to queue it again.

Thx

@popy2k14
Copy link

popy2k14 commented Jan 31, 2024

I have now done this as a workaround.

Workaround removed, was not working.

I think it's an overkill and there should be (or is?) an lifetime infinity value like -1.

@andrewjswan
Copy link

So queue is not empty and no clock is shown.

Look #93

@popy2k14
Copy link

So queue is not empty and no clock is shown.

Look #93

That's exactly my issue!
I don't see permanent screens in the documentation, so I am assuming that is not implemented?
Should I'll open an issue for that?

My workaround for now:

#workaround that clock doesnt disappear after lifetime

interval:
  - interval: 720min
    then:
      lambda: |-
        ESP_LOGI("clock/date", "set clock and date screen!");
        id(rgb8x32)->clock_screen(1440,10);
        id(rgb8x32)->date_screen(1440,5);

That should keep the clock alive.

@andrewjswan
Copy link

The Issue was not opened, apparently everyone decided it similar to your solution, I recreate it once a day.

Whether to open it or not is up to you.

@popy2k14
Copy link

Done see #208

@popy2k14
Copy link

popy2k14 commented Feb 2, 2024

As stated, since I am on 2024.1.0 the clock crashes 50% after OTA (black screen) and needs a serial reflash to bring it back to live. This happens on my two clocks. Two times also just a few minutes after flash. The WAF is currently not so high, so I reverted to V1, and all runs fine again.

PS: maybe it has Todo with my HW mods (always on mod + no battery + DC/DC converter).

But as stated it's rock solid on v1

@andrewjswan
Copy link

This happens on my two clocks.

I have Ulanzy TC001 and no problem? In you clock Esp32? or 8266? Maybe decrease icon count and check?

@popy2k14
Copy link

popy2k14 commented Feb 4, 2024

I have two ulanzi's with ESP32 and both showed the issue.
It's not just an Software crash.
And cold start (unplug and replug) does NOT solve the issue.
As stated the clock's are dead! I have to reflash them.

Sorry the WAF was very low, i am now back at v1 since two days, and they are running flawlessly.
Currently cant help debug any further.

@andrewjswan
Copy link

Yesterday I flashed Ulanzi without any problems.

@andrewjswan
Copy link

Look like we need 2024.2.0 release :)

@andreasbrett
Copy link

Looks like we need a 2024.3.0 release ;-P

@lubeda
Copy link
Owner Author

lubeda commented Feb 29, 2024

OK, I released a very but didn't improve the documentation like I had planned. :-( Too much work too few time!

Thanks for your support!

@riker09
Copy link

riker09 commented Mar 1, 2024

You (and all the other contributors) are doing an amazing job. Thanks so much for all your hard work on this helpful software.

@popy2k14
Copy link

popy2k14 commented Mar 29, 2024

@andrewjswan here is a serial log when the issue described above happens. It just doesnt boot anymore after a while:

[I][logger:158]: Log initialized
[C][ota:483]: There have been 9 suspected unsuccessful boot attempts.
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[D][EHMTXv2:024]: Constructor start
[D][EHMTXv2:199]: default today color r: 240 g: 240 b: 240
[D][EHMTXv2:205]: default weekday color: 100 g: 100 b: 100
[D][EHMTXv2:074]: Constructor finish
[D][EHMTXv2:2754]: add_icon no.: 0 name: ha frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 1 name: tempc frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 2 name: plug frame_duration: 192 ms
[D][EHMTXv2:2754]: add_icon no.: 3 name: humidity frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 4 name: co2 frame_duration: 300 ms
[D][EHMTXv2:2754]: add_icon no.: 5 name: weather_clear_night frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 6 name: weather_cloudy frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 7 name: weather_fog frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 8 name: weather_hail frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 9 name: weather_lightning frame_duration: 400 ms
[D][EHMTXv2:2754]: add_icon no.: 10 name: weather_lightning_rainy frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 11 name: weather_partlycloudy frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 12 name: weather_pouring frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 13 name: weather_rainy frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 14 name: weather_snowy frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 15 name: weather_snowy_rainy frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 16 name: weather_sunny frame_duration: 500 ms
[D][EHMTXv2:2754]: add_icon no.: 17 name: weather_windy frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 18 name: weather_windy_variant frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 19 name: weather_exceptional frame_duration: 20 ms
[D][EHMTXv2:2754]: add_icon no.: 20 name: washing_machine_ready frame_duration: 200 ms
[D][EHMTXv2:2754]: add_icon no.: 21 name: dryer_ready frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 22 name: dishwasher_ready frame_duration: 300 ms
[D][EHMTXv2:2754]: add_icon no.: 23 name: door_ringing frame_duration: 300 ms
[D][EHMTXv2:2754]: add_icon no.: 24 name: fire frame_duration: 100 ms
[D][EHMTXv2:2754]: add_icon no.: 25 name: water frame_duration: 200 ms
[D][EHMTXv2:2329]: set_display
[D][EHMTXv2:2407]: set_clock
[I][EHMTXv2:2309]: set_brightness 80 => 31.37 %
[I][EHMTXv2:1515]: replace_time_date off
[I][EHMTXv2:2300]: don't show day of week
[I][EHMTXv2:2294]: don't show seconds
[I][app:029]: Running through setup()...
[I][i2c.arduino:197]: Performing I2C bus recovery
[D][binary_sensor:034]: 'Left button': Sending initial state OFF
[D][binary_sensor:034]: 'Middle button': Sending initial state OFF
[D][binary_sensor:034]: 'Right button': Sending initial state OFF
[C][light:035]: Setting up light 'Light'...
[D][light:036]: 'Light' Setting:
[D][light:041]:   Color mode: RGB
[D][light:085]:   Transition length: 1.0s
[D][template.switch:046]:   Restored state OFF
[D][switch:016]: 'Display' Turning OFF.
[D][EHMTXv2:142]: display off
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400d37a4  PS      : 0x00060c30  A0      : 0x800dba33  A1      : 0x3ffb2380
A2      : 0x00000000  A3      : 0x401ba5f8  A4      : 0x00000000  A5      : 0x00000000
A6      : 0x00000008  A7      : 0x00000000  A8      : 0x800d379c  A9      : 0x3ffb2360
A10     : 0x00000000  A11     : 0x3ffb2388  A12     : 0x3ffb238c  A13     : 0x00007ffe
A14     : 0x0000000b  A15     : 0x00000010  SAR     : 0x00000004  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000  LBEG    : 0x4008b191  LEND    : 0x4008b1a1  LCOUNT  : 0xffffffff


Backtrace:0x400d37a1:0x3ffb23800x400dba30:0x3ffb23b0 0x401b8af9:0x3ffb23e0 0x400db6d9:0x3ffb2400 0x400db709:0x3ffb2420 0x400db6be:0x3ffb2440 0x400dec92:0x3ffb2460 0x400fb018:0x3ffb2480 0x400faed5:0x3ffb24a0 0x401ba4d7:0x3ffb24c0 0x401b9a79:0x3ffb24e0 0x400f10f9:0x3ffb2500 0x400f0a73:0x3ffb2520 0x400f1080:0x3ffb2540 0x400f108e:0x3ffb2570 0x401b9f55:0x3ffb2590 0x401b9ff1:0x3ffb25b0 0x400f91e1:0x3ffb25d0 0x400fef22:0x3ffb2600 0x4010d12a:0x3ffb2820




ELF file SHA256: 0000000000000000

Rebooting...

And here is part of important yaml:

substitutions:
  # Pin definition from https://github.com/aptonline/PixelIt_Ulanzi 
  battery_pin: GPIO34 
  ldr_pin: GPIO35 
  matrix_pin: GPIO32 
  left_button_pin: GPIO26 
  mid_button_pin: GPIO27 
  right_button_pin: GPIO14 
  scl_pin: GPIO22 
  sda_pin: GPIO21 
  
external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EspHoMaTriXv2
      ref: 2024.3.0
    refresh: 120min
    components: [ehmtxv2]  

esphome:
  comment: "Ulanzi TC001"
  project:
    name: "Ulanzi.EHMTXv2"
    version: "2.0.0"
  on_boot:
    then:
      - ds1307.read_time:

esp32:
  board: esp32dev

#include device_base yaml
packages:
  device_base: !include /config/esphome/common/device_base.yaml

font:
  # Font included in this folder
  # - file: mateine.ttf
  #   size: 16
  #   id: default_font
  #   glyphs:  |
  #     !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz@<>ߧ€/
  # Matrix Clock Fonts
  # Grab these from https://github.com/trip5/Matrix-Fonts
  # See https://github.com/lubeda/EspHoMaTriXv2#font
  # Store in a "fonts" subfolder of your ESPHome config folder or change paths below
  #- file: fonts/MatrixLight8.bdf
  #  id: default_font
  #  glyphs:  |
  #    ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°
  #- file: fonts/MatrixChunky6.bdf
  #  id: special_font
  #  glyphs:  |
  #    ! "#$%&'()*+,-./0123456789:APMTapmt
  - file: fonts/Calcium.ttf
    id: default_font
    size: 16
    glyphs:  |
      !?"%‰()+*=,-_.:°µ²³0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz€$@<>/

globals:
  # aab = auto-adjustable brightness
  - id: aab_enable
    type: "bool"
    restore_value: true
    initial_value: "true"
  - id: aab_add
    type: int
    initial_value: '10'
  - id: aab_max
    type: int
    initial_value: '220'
  - id: aab_min
    type: int
    initial_value: '40'

ehmtxv2:
  id: rgb8x32
  icons2html: true
  matrix_component: ehmtx_display
  time_component: ehmtx_time
  time_format: "%H:%M"
  date_format: "%d.%m"
  show_seconds: false
  # Uncomment below if using the mateine font
  default_font_id: default_font
  special_font_id: default_font
  default_font_yoffset: 8
  special_font_yoffset: 8  
  # Comment out below if using mateine font
  #default_font_id: default_font
  #default_font_yoffset: 8
  #special_font_id: special_font
  #special_font_yoffset: 6
  # until here
  
  # black boot logo with red dot
  boot_logo: "[60000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
  
  clock_interval: 20      # show the clock at least each x seconds
  show_dow: false         # draw the day indicator on the bottom of the screen, defaults to true
  #show_date: true         # show the date for show_screen - show_clock seconds otherwise only shows the clock for show_screen seconds, defaults to true
  week_start_monday: true # default monday is first day of week, false = sunday
  night_mode_screens: [2, 16]
  icons:
    - id: ha
      lameid: 7956
    - id: tempc
      lameid: 2422
    - id: plug
      lameid: 403
    - id: humidity
      lameid: 51764
    - id: co2
      lameid: 30662
    - id: weather_clear_night
      lameid: 53383
    - id: weather_cloudy
      lameid: 53384
    - id: weather_fog
      lameid: 12196  
    - id: weather_hail
      lameid: 53385  
    - id: weather_lightning
      lameid: 50231  
    - id: weather_lightning_rainy
      lameid: 49299  
    - id: weather_partlycloudy
      lameid: 53802  
    - id: weather_pouring
      lameid: 49300  
    - id: weather_rainy
      lameid: 2284  
    - id: weather_snowy
      lameid: 2289  
    - id: weather_snowy_rainy
      lameid: 49301  
    - id: weather_sunny
      lameid: 1246
    - id: weather_windy
      lameid: 17076  
    - id: weather_windy_variant
      lameid: 15618  
    - id: weather_exceptional
      lameid: 5464    
    - id: washing_machine_ready
      lameid: 26673
    - id: dryer_ready
      lameid: 48497
    - id: dishwasher_ready
      lameid: 47488
    - id: door_ringing
      lameid: 24800
    - id: fire
      lameid: 24873
    - id: water
      lameid: 24116
  on_empty_queue:
    then:
      lambda: |-
        id(rgb8x32)->clock_screen(1440,10);
        id(rgb8x32)->date_screen(1440,5);
  on_start_running:
     then:
       lambda: |-
          id(rgb8x32)->clock_screen(1440,10);
          id(rgb8x32)->date_screen(1440,5);
  on_next_screen:
    - homeassistant.event:
        event: esphome.new_screen
        data_template:
          iconname: !lambda "return icon.c_str();"
          text: !lambda "return text.c_str();"
  on_night_mode:
    then:
      lambda: |-
        if (state) {
            id(aab_enable) = false;
            id(rgb8x32)->set_brightness(20);
            id(rgb8x32)->set_clock_color(235, 0, 0);
        } else {
            id(aab_enable) = true;
            id(rgb8x32)->set_clock_color(255, 255, 255);
        }

#workaround that clock doesnt disappear after lifetime
interval:
  - interval: 720min
    then:
      lambda: |-
        ESP_LOGI("clock/date", "set clock and date screen!");
        id(rgb8x32)->clock_screen(1440,10);
        id(rgb8x32)->date_screen(1440,5);

# workaround for compiling errors on esphome 2023.07: https://github.com/lubeda/EspHoMaTriXv2/issues/62#issuecomment-1643052894
animation:
  - id: animation_black
    file: icons/black_1x1_EspHoMaTriX.gif
          
binary_sensor:
  - platform: status
    name: "Status"
  - platform: gpio
    pin:
      number: $left_button_pin
      inverted: true
    name: "Left button"
    on_press:
      then:
        - number.decrement: screen_brightness
  - platform: gpio
    pin: 
      inverted: true
      number: $mid_button_pin
      mode: INPUT_PULLUP
    name: "Middle button"
    on_press:
      then:
        - switch.toggle: displaycontrol      
  - platform: gpio
    pin: 
      number: $right_button_pin
      inverted: true
    name: "Right button"
    on_press:
      then:
        - number.increment: screen_brightness
# example to switch to next screen
#        lambda: |-
#          id(rgb8x32)->skip_screen();

# Enable Home Assistant API
api:
  services:
    - service: brightness_set
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);
    - service: skip_screen
      then:
        lambda: |-
          id(rgb8x32)->skip_screen();
#disabled, we dont need the buzzer
#    - service: tuneplay
#      variables:
#        tune: string
#      then:
#        - rtttl.play:
#            rtttl: !lambda 'return tune;'

number:
  - platform: template
    name: "Brightness"
    id: screen_brightness
    min_value: 0
    max_value: 255
    update_interval: 1s
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

switch:
  - platform: template
    name: "Display"
    id: displaycontrol
    icon: "mdi:power"
    restore_mode: RESTORE_DEFAULT_ON
    lambda: |-
      return id(rgb8x32)->show_display;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_display_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_display_off();
  - platform: template
    name: "Auto-Adjust Brightness"
    id: switch_autobrightness
    icon: mdi:brightness-auto
    restore_mode: RESTORE_DEFAULT_ON
    lambda: |-
      if (id(aab_enable)) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      lambda: |-
        id(aab_enable) = true;
    turn_off_action:
      lambda: |-
        id(aab_enable) = false;
  - platform: template

    name: "Night mode"
    id: switch_night_mode
    icon: mdi:sleep
    restore_mode: RESTORE_DEFAULT_OFF
    lambda: |-
        return id(rgb8x32)->night_mode;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_night_mode_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_night_mode_off();
        
sensor:
  - platform: sht3xd
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    update_interval: 60s
  - platform: adc
    id: light_sensor
    name: "Illuminance"
    pin: $ldr_pin
    device_class: illuminance    
    update_interval: 10s
    attenuation: auto
    unit_of_measurement: lx
    accuracy_decimals: 0
    filters:
      - lambda: |-
          return (x / 10000.0) * 2000000.0 - 15 ;
    on_value:
      then:
        - lambda: |-
            if ( id(aab_enable) ) {
              int n = x / 4 + id(aab_add); // new_value
              if (n > id(aab_max)) n = id(aab_max);
              if (n < id(aab_min)) n = id(aab_min);
              int c = id(rgb8x32)->get_brightness(); // current value
              c = c>0?c:1 ; 
              int d = (n - c) * 100 / c; // diff in %
              if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n);
            }
            
#disabled, we dont need the buzzer     
#output:
#  - platform: ledc
#    pin: $buzzer_pin
#    id: rtttl_out

#rtttl:
#  output: rtttl_out

#The hardware design of the ulanzi isn't perfect. If your ulanzi makes a crazy beeping noise after removinf the rtttl-component you may use this setting to make it silent again.
output:
  - platform: gpio
    pin: GPIO15
    id: crazy_hardware_workaround

i2c:
  sda: $sda_pin
  scl: $scl_pin
  scan: true
  id: i2cbus

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    internal: true
    variant: WS2812
    pin: $matrix_pin
    num_leds: 256
    color_correct: [30%, 30%, 30%]
    gamma_correct: 2.0
    name: "Light"
    restore_mode: ALWAYS_OFF
    
time:
  - platform: homeassistant
    on_time_sync:
      then:
        ds1307.write_time:
  - platform: ds1307
    update_interval: never
    id: ehmtx_time

 
display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (y % 2 == 0) {
        return (y * 32) + x;
      }
      return (y * 32) + (31 - x);
    rotation: 0°
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

As stated, v1 is running without an issue.

I think it has todo with the display switch restore state to off, calling "id(rgb8x32)->set_display_off();" on boot.

[D][template.switch:046]:   Restored state OFF
[D][switch:016]: 'Display' Turning OFF.
[D][EHMTXv2:142]: display off
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

When the display was on (written to flash) before reboot the clock boots up normally after power down.
The log then looks like:

[C][light:035]: Setting up light 'Light'...
[D][light:036]: 'Light' Setting:
[D][light:041]:   Color mode: RGB
[D][light:085]:   Transition length: 1.0s
**[D][template.switch:046]:   Restored state ON
[D][switch:012]: 'Display' Turning ON.
[D][EHMTXv2:154]: display on**
[D][template.switch:046]:   Restored state ON
[D][switch:012]: 'Auto-Adjust Brightness' Turning ON.

So it seems when calling "id(rgb8x32)->set_display_off();" during boot, it fails.

Any chance that you use my config to reproduce the issue?

Thank you

@popy2k14
Copy link

Now i can reproduce the issue!

  • Flash a v2 with my config (at least with the display switch part)
  • Switch the display off (in HA) and wait until the log shows "written to flash..."
  • Unplug the clock
  • Replug the clock
  • -> it does'nt boot and crashes with the error above
  • To revive it, flash another binary which erases the flash (i am cross flashing v1 to revive it)

@popy2k14
Copy link

popy2k14 commented Mar 29, 2024

Easier to reproduce, just add the following switch with "restore_mode: ALWAYS_OFF":

switch:
  - platform: template
    name: "Display"
    id: displaycontrol
    icon: "mdi:power"
    **restore_mode: ALWAYS_OFF**
    lambda: |-
      return id(rgb8x32)->show_display;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_display_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_display_off();

The issue happens immediately on boot.
I am not so deep in the esphomematrix v2 code.

@andrewjswan Can you please look into the issue?

Thank you

@popy2k14
Copy link

@andrewjswan @lubeda i have created an issue here: #222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants