Skip to content

Instantly share code, notes, and snippets.

@funkfinger
Last active July 28, 2025 18:17
Show Gist options
  • Select an option

  • Save funkfinger/a0dda51163ca2cb8abae560b43cf5093 to your computer and use it in GitHub Desktop.

Select an option

Save funkfinger/a0dda51163ca2cb8abae560b43cf5093 to your computer and use it in GitHub Desktop.

Revisions

  1. funkfinger revised this gist Jul 28, 2025. 1 changed file with 50 additions and 48 deletions.
    98 changes: 50 additions & 48 deletions led-hub-matrix-test.yaml
    Original file line number Diff line number Diff line change
    @@ -4,49 +4,44 @@
    ###################################################
    ### ###
    ### The current version of ESPHome ###
    ### 2025.7.0 DOES NOT WORK! I used ###
    ### 2025.5.0 and it works. Need ###
    ### to look into why on ESP32-S2. ###
    ### 2025.7.0 MIGHT NOT WORK! I used ###
    ### 2025.5.0 and it works. ###
    ### ###
    ###################################################

    substitutions:
    device_name: album-art-workroom
    device_friendly_name: Album Art - Workroom
    board: lolin_s2_mini
    device_variant: ESP32S2
    device_name: album-art-living-room
    device_friendly_name: Album Art - Living Room
    board: esp32-s3-devkitc-1
    device_variant: ESP32S3
    framework: arduino
    flash_size: 4MB
    album_art_url_sensor: sensor.album_art_workroom_url
    flash_size: 8MB
    album_art_url_sensor: sensor.album_art_living_url
    api_encryption_key: !secret album-art-living-room-key
    ha_hostname: homeassistant.local:8123 # Home Assistant hostname and port
    api_encryption_key: !secret album-art-workroom-key
    psram_mode: quad
    psram_speed: 40MHz
    psram_mode: octal
    psram_speed: 80MHz

    esphome:
    name: ${device_name}
    friendly_name: ${device_friendly_name}

    # on_boot:
    # - lambda: id(my_ota).set_auth_password("NEW OTA PASSWORD HERE");
    ####### - ESP32-S3 DevKit only????
    platformio_options:
    board_build.arduino.memory_type: dio_opi

    esp32:
    board: ${board}
    # variant: ${device_variant}
    # flash_size: ${flash_size}
    variant: ${device_variant}
    flash_size: ${flash_size}
    framework:
    type: ${framework}

    psram:
    mode: ${psram_mode}
    speed: ${psram_speed}

    # Enable logging
    logger:

    # Enable Home Assistant API
    api:
    port: 6053
    encryption:
    key: ${api_encryption_key}

    @@ -59,13 +54,12 @@ wifi:
    ssid: !secret wifi_ssid
    password: !secret wifi_password

    # Enable fallback hot spot (captive portal) in case wifi connection fails
    # ap:
    # ssid: ${device_name}
    # password: !secret ap_wifi_pw
    # Enable fallback hotspot (captive portal) in case wifi connection fails
    ap:
    ssid: ${device_name}
    password: !secret ap_wifi_pw

    # web_server:
    # port: 80
    captive_portal:

    #################### IMAGE URL PORTION ########################

    @@ -107,8 +101,12 @@ online_image:

    #################### DISPLAY PORTION FOR ESP32-S3 DEVKIT ########################

    psram:
    mode: ${psram_mode}
    speed: ${psram_speed}

    external_components:
    - source: github://funkfinger/ESPHome-HUB75-MatrixDisplayWrapper@update-ESP32-HUB75-MatrixPanel-DMA
    - source: github://funkfinger/ESPHome-HUB75-MatrixDisplayWrapper@fix-switch.SWITCH_SCHEMA-deprecation

    font:
    - file: "gfonts://Roboto"
    @@ -121,29 +119,30 @@ display:
    width: 64
    height: 64

    R1_pin: 1
    G1_pin: 40
    # esp32-s3 devkit board pinout
    R1_pin: 4
    G1_pin: 1

    B1_pin: 2
    #gnd pin 38
    B1_pin: 5
    #gnd pin 2

    R2_pin: 4
    G2_pin: 36
    R2_pin: 6
    G2_pin: 42

    B2_pin: 6
    E_pin: 34
    B2_pin: 7
    E_pin: 41

    A_pin: 8
    B_pin: 21
    A_pin: 15
    B_pin: 40

    C_pin: 10
    D_pin: 17
    C_pin: 16
    D_pin: 39

    CLK_pin: 13
    LAT_pin: 15
    CLK_pin: 17
    LAT_pin: 38

    OE_pin: 14
    #gnd pin soldered
    OE_pin: 18
    #gnd pin 9

    lambda: |-
    if (id(album_image).get_width() == 0 || id(album_image).get_height() == 0) {
    @@ -153,15 +152,19 @@ display:
    it.image(0, 0, id(album_image));
    }
    # lambda: it.printf(2, 32, id(roboto), "blah blah");

    switch:
    - platform: gpio
    pin: 38
    pin: 2
    id: gnd1
    internal: true
    restore_mode: ALWAYS_OFF

    - platform: gpio
    pin: 9
    id: gnd2
    internal: true
    restore_mode: ALWAYS_OFF

    - platform: hub75_matrix_display
    matrix_id: album_artwork_display
    name: "${device_name} Power"
    @@ -174,4 +177,3 @@ number:
    name: "${device_name} Brightness"
    id: brightness
    ###############################################################

  2. funkfinger revised this gist Jul 28, 2025. 1 changed file with 54 additions and 46 deletions.
    100 changes: 54 additions & 46 deletions led-hub-matrix-test.yaml
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,27 @@
    ########## I hesitate to post this, but perhaps someone will find it interesting enough to make it better / more robust....
    ########## See comments for the most minimal of explanation

    ###################################################
    ### ###
    ### The current version of ESPHome ###
    ### 2025.7.0 DOES NOT WORK! I used ###
    ### 2025.5.0 and it works. Need ###
    ### to look into why on ESP32-S2. ###
    ### ###
    ###################################################

    substitutions:
    device_name: led-hub-matrix-test-1
    device_friendly_name: LED Hub Matrix Test 1
    board: esp32-s3-devkitc-1
    device_variant: ESP32S3
    device_name: album-art-workroom
    device_friendly_name: Album Art - Workroom
    board: lolin_s2_mini
    device_variant: ESP32S2
    framework: arduino
    flash_size: 8MB
    flash_size: 4MB
    album_art_url_sensor: sensor.album_art_workroom_url
    ha_hostname: homeassistant.local:8123 # Home Assistant hostname and port
    api_encryption_key: !secret album-art-workroom-key
    psram_mode: quad
    psram_speed: 40MHz

    esphome:
    name: ${device_name}
    @@ -20,18 +32,23 @@ esphome:

    esp32:
    board: ${board}
    variant: ${device_variant}
    flash_size: ${flash_size}
    # variant: ${device_variant}
    # flash_size: ${flash_size}
    framework:
    type: ${framework}

    psram:
    mode: ${psram_mode}
    speed: ${psram_speed}

    # Enable logging
    logger:

    # Enable Home Assistant API
    api:
    port: 6053
    encryption:
    key: !secret led-hub-matrix-test-1-key
    key: ${api_encryption_key}

    ota:
    - platform: esphome
    @@ -42,12 +59,13 @@ wifi:
    ssid: !secret wifi_ssid
    password: !secret wifi_password

    # Enable fallback hotspot (captive portal) in case wifi connection fails
    ap:
    ssid: ${device_name}
    password: !secret ap_wifi_pw
    # Enable fallback hot spot (captive portal) in case wifi connection fails
    # ap:
    # ssid: ${device_name}
    # password: !secret ap_wifi_pw

    captive_portal:
    # web_server:
    # port: 80

    #################### IMAGE URL PORTION ########################

    @@ -87,72 +105,62 @@ online_image:
    - logger.log: "Image downloaded successfully"
    - component.update: album_artwork_display


    #################### DISPLAY PORTION FOR ESP32-S3 DEVKIT ########################

    psram:
    mode: octal
    speed: 80MHz

    external_components:
    - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main
    - source: github://funkfinger/ESPHome-HUB75-MatrixDisplayWrapper@update-ESP32-HUB75-MatrixPanel-DMA

    font:
    - file: "gfonts://Roboto"
    id: roboto
    size: 9
    size: 10

    display:
    - platform: hub75_matrix_display
    id: album_artwork_display
    width: 64
    height: 64

    # esp32-s3 devkit board pinout
    R1_pin: 4
    G1_pin: 1
    R1_pin: 1
    G1_pin: 40

    B1_pin: 5
    #gnd pin 2
    B1_pin: 2
    #gnd pin 38

    R2_pin: 6
    G2_pin: 42
    R2_pin: 4
    G2_pin: 36

    B2_pin: 7
    E_pin: 41
    B2_pin: 6
    E_pin: 34

    A_pin: 15
    B_pin: 40
    A_pin: 8
    B_pin: 21

    C_pin: 16
    D_pin: 39
    C_pin: 10
    D_pin: 17

    CLK_pin: 17
    LAT_pin: 38
    CLK_pin: 13
    LAT_pin: 15

    OE_pin: 18
    #gnd pin 9
    OE_pin: 14
    #gnd pin soldered

    lambda: |-
    if (id(album_image).get_width() == 0 || id(album_image).get_height() == 0) {
    it.printf(2, 32, id(roboto), "No Album Art");
    }
    else {
    it.image(0, 0, id(album_image));
    }
    }
    # lambda: it.printf(2, 32, id(roboto), "blah blah");

    switch:
    - platform: gpio
    pin: 2
    pin: 38
    id: gnd1
    internal: true
    restore_mode: ALWAYS_OFF

    - platform: gpio
    pin: 9
    id: gnd2
    internal: true
    restore_mode: ALWAYS_OFF

    - platform: hub75_matrix_display
    matrix_id: album_artwork_display
    @@ -165,5 +173,5 @@ number:
    matrix_id: album_artwork_display
    name: "${device_name} Brightness"
    id: brightness
    ###############################################################

    ###############################################################
  3. funkfinger revised this gist Jul 15, 2025. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions led-hub-matrix-test.yaml
    Original file line number Diff line number Diff line change
    @@ -141,15 +141,19 @@ display:
    it.image(0, 0, id(album_image));
    }
    output:
    switch:
    - platform: gpio
    pin: 2
    id: gnd1
    internal: true
    restore_mode: ALWAYS_OFF

    - platform: gpio
    pin: 9
    id: gnd2
    internal: true
    restore_mode: ALWAYS_OFF

    switch:
    - platform: hub75_matrix_display
    matrix_id: album_artwork_display
    name: "${device_name} Power"
  4. funkfinger revised this gist Jul 15, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions led-hub-matrix-test.yaml
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    ########## I hesitate to post this, but perhaps someone will find it interesting enough to make it better / more robust....
    ########## See comments for the most minimal of explanation

    substitutions:
    device_name: led-hub-matrix-test-1
    device_friendly_name: LED Hub Matrix Test 1
  5. funkfinger revised this gist Jul 15, 2025. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions led-hub-matrix-test.yaml
    Original file line number Diff line number Diff line change
    @@ -8,11 +8,6 @@ substitutions:
    album_art_url_sensor: sensor.album_art_workroom_url
    ha_hostname: homeassistant.local:8123 # Home Assistant hostname and port

    # time_to_dim: "300" # 5 min in seconds
    # time_to_turn_off: "600" # 10 min in seconds
    # on_brightness: "250"
    # dim_brightness: "80"

    esphome:
    name: ${device_name}
    friendly_name: ${device_friendly_name}
  6. funkfinger revised this gist Jul 15, 2025. No changes.
  7. funkfinger renamed this gist Jul 15, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. funkfinger created this gist Jul 15, 2025.
    167 changes: 167 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,167 @@
    substitutions:
    device_name: led-hub-matrix-test-1
    device_friendly_name: LED Hub Matrix Test 1
    board: esp32-s3-devkitc-1
    device_variant: ESP32S3
    framework: arduino
    flash_size: 8MB
    album_art_url_sensor: sensor.album_art_workroom_url
    ha_hostname: homeassistant.local:8123 # Home Assistant hostname and port

    # time_to_dim: "300" # 5 min in seconds
    # time_to_turn_off: "600" # 10 min in seconds
    # on_brightness: "250"
    # dim_brightness: "80"

    esphome:
    name: ${device_name}
    friendly_name: ${device_friendly_name}

    # on_boot:
    # - lambda: id(my_ota).set_auth_password("NEW OTA PASSWORD HERE");

    esp32:
    board: ${board}
    variant: ${device_variant}
    flash_size: ${flash_size}
    framework:
    type: ${framework}

    # Enable logging
    logger:

    # Enable Home Assistant API
    api:
    encryption:
    key: !secret led-hub-matrix-test-1-key

    ota:
    - platform: esphome
    id: my_ota
    password: !secret ota_password

    wifi:
    ssid: !secret wifi_ssid
    password: !secret wifi_password

    # Enable fallback hotspot (captive portal) in case wifi connection fails
    ap:
    ssid: ${device_name}
    password: !secret ap_wifi_pw

    captive_portal:

    #################### IMAGE URL PORTION ########################

    text_sensor:
    - platform: homeassistant
    id: playing_track_artwork
    entity_id: ${album_art_url_sensor}
    on_value:
    then:
    - homeassistant.action:
    action: image_resizer.resize_image
    data:
    quality: "95"
    method: lanczos
    source: "{{ states('${album_art_url_sensor}') }}"
    width: "64"
    height: "64"
    keep_aspect_ratio: "False"
    format: JPEG
    destination: "/config/www/${device_name}.jpg"
    - delay: 5s
    - component.update: album_image

    http_request:
    verify_ssl: false
    timeout: 10s
    useragent: ESPHome/Album-Art

    online_image:
    - url: "http://${ha_hostname}/local/${device_name}.jpg"
    format: jpg
    id: album_image
    type: RGB
    update_interval: never # Only update when explicitly requested
    on_download_finished:
    then:
    - logger.log: "Image downloaded successfully"
    - component.update: album_artwork_display


    #################### DISPLAY PORTION FOR ESP32-S3 DEVKIT ########################

    psram:
    mode: octal
    speed: 80MHz

    external_components:
    - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main

    font:
    - file: "gfonts://Roboto"
    id: roboto
    size: 9

    display:
    - platform: hub75_matrix_display
    id: album_artwork_display
    width: 64
    height: 64

    # esp32-s3 devkit board pinout
    R1_pin: 4
    G1_pin: 1

    B1_pin: 5
    #gnd pin 2

    R2_pin: 6
    G2_pin: 42

    B2_pin: 7
    E_pin: 41

    A_pin: 15
    B_pin: 40

    C_pin: 16
    D_pin: 39

    CLK_pin: 17
    LAT_pin: 38

    OE_pin: 18
    #gnd pin 9

    lambda: |-
    if (id(album_image).get_width() == 0 || id(album_image).get_height() == 0) {
    it.printf(2, 32, id(roboto), "No Album Art");
    }
    else {
    it.image(0, 0, id(album_image));
    }

    output:
    - platform: gpio
    pin: 2
    id: gnd1
    - platform: gpio
    pin: 9
    id: gnd2

    switch:
    - platform: hub75_matrix_display
    matrix_id: album_artwork_display
    name: "${device_name} Power"
    id: power
    restore_mode: ALWAYS_ON

    number:
    - platform: hub75_matrix_display
    matrix_id: album_artwork_display
    name: "${device_name} Brightness"
    id: brightness

    ###############################################################