Skip to content

Instantly share code, notes, and snippets.

@GuySie
Last active April 19, 2025 10:17
Show Gist options
  • Select an option

  • Save GuySie/ad00ee1dfcd70314c966027c1e8d0694 to your computer and use it in GitHub Desktop.

Select an option

Save GuySie/ad00ee1dfcd70314c966027c1e8d0694 to your computer and use it in GitHub Desktop.
Espressif S3box Music Assistant covert art display
## Change Music Assistant entity to track in line 8, mediaplayer_entity, below:
substitutions:
name: s3box-ma-kitchen
friendly_name: "Kitchen Music Assistant"
project_name: "Guy Sie.Kitchen Music Assistant"
project_version: "0.1.0"
mediaplayer_entity: media_player.ma_homepod_kitchen
api_key: !secret api_key
ota_password: !secret ota_password
ap_password: !secret ap_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
font_glyphs: '&@!"''%()+=,-_.:°/$€£¥?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzÀàÁáÂâÃãÄäĀāĂăÅåǺǻẠạĄąÆæǼǽĆćĈĉČčĊċÇçĎďĐđÐðÈèÉéÊêẼẽĚěËëĒēĔĕĖėẸẹĘęĜĝǦǧĞğĠġĢģĤĥĦħıÌìÍíÎîĨĩÏïĪīĬĭİỊịĮįȷĴĵĶķĸĹ弾ĻļŁłĿŀŃńÑñŇňŅņƝɲŊŋʼnÒòÓóÔôÕõÖöŌōŎŏŐőỌọǪǫØøǾǿŒœŔŕŘřŖŗŚśŜŝŠšŞşȘșẞߍťŢţȚțŦŧÞþÙùÚúÛûŨũÜüŪūŬŭŮůŰűỤụŲųẀẁẂẃŴŵẄẅỲỳÝýŶŷỸỹŸÿȲȳŹźŽžŻżIJijƏə'
####################################################
esphome:
name: ${name}
friendly_name: ${friendly_name}
project:
name: ${project_name}
version: ${project_version}
min_version: 2025.2.0
esp32:
board: esp32s3box
flash_size: 16MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
psram:
mode: octal
speed: 80MHz
api:
encryption:
key: ${api_key}
ota:
- platform: esphome
password: ${ota_password}
logger:
hardware_uart: USB_SERIAL_JTAG
logs:
text_sensor: WARN
component: ERROR
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
ap:
ssid: ${name}
password: ${ap_password}
captive_portal:
http_request:
time:
- platform: homeassistant
id: ha_time
timezone: Europe/Amsterdam
button:
- platform: restart
id: reboot
name: "Reboot"
entity_category: diagnostic
output:
- platform: ledc
pin: GPIO47
id: backlight_output
light:
- platform: monochromatic
id: led
name: LCD Backlight
entity_category: config
output: backlight_output
restore_mode: ALWAYS_OFF
default_transition_length: 50ms
sensor:
# - platform: aht10 # remove for no sensor version
# i2c_id: bus_b
# variant: AHT20
# temperature:
# name: "S3 Temperature"
# id: s3temp
# humidity:
# name: "S3 Humidity"
# update_interval: 60s
# - platform: adc # remove for no sensor version
# pin: GPIO10
# id: battery_voltage
# unit_of_measurement: "V"
# accuracy_decimals: 1
# device_class: "voltage"
# entity_category: "diagnostic"
# disabled_by_default: true
# update_interval: 30s
# attenuation: auto
# filters:
# - multiply: 4.11
# - platform: copy # remove for no sensor version
# id: battery_percent
# source_id: battery_voltage
# name: "Battery level"
# unit_of_measurement: "%"
# accuracy_decimals: 0
# device_class: "battery"
# entity_category: "diagnostic"
# filters:
# - lambda: return (x - 2.7) / (4.2 - 2.7) * 100;
# - clamp:
# min_value: 0
# max_value: 100
- platform: wifi_signal
name: "WiFi db"
id: wifi_signal_db
update_interval: 30s
- platform: copy
source_id: wifi_signal_db
name: "WiFi Signal"
id: wifi_percent
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
device_class: ""
text_sensor:
- platform: homeassistant
id: sensor_media_playing
name: MA Kitchen Media Playing
entity_id: ${mediaplayer_entity}
on_value:
then:
- if:
any:
- text_sensor.state:
id: sensor_media_playing
state: 'playing'
- text_sensor.state:
id: sensor_media_playing
state: 'paused'
then:
- lvgl.label.update:
id: title
text:
format: "%s"
args: [ 'id(sensor_media_title).state.c_str()' ]
- lvgl.label.update:
id: artist
text:
format: "%s"
args: [ 'id(sensor_media_artist).state.c_str()' ]
- online_image.set_url:
id: album_image
url: !lambda return id(sensor_entity_picture).state;
- light.turn_on: led
else:
- lvgl.label.update:
id: title
text: "Media Title"
- lvgl.label.update:
id: artist
text: "Media Artist"
- lvgl.image.update:
id: albumart
src: holdplace
- light.turn_off: led
- platform: homeassistant
id: sensor_media_title
name: MA Kitchen Media Title
entity_id: ${mediaplayer_entity}
attribute: media_title
- platform: homeassistant
id: sensor_media_artist
name: MA Kitchen Media Artist
entity_id: ${mediaplayer_entity}
attribute: media_artist
- platform: homeassistant
id: sensor_media_album_name
name: MA Kitchen Media Album
entity_id: ${mediaplayer_entity}
attribute: media_album_name
- platform: homeassistant
id: sensor_entity_picture
name: MA Kitchen Media Picture
entity_id: ${mediaplayer_entity}
attribute: entity_picture
on_value:
then:
- online_image.set_url:
id: album_image
url: !lambda return id(sensor_entity_picture).state;
## Upload a blank 160x160 pixel image to your Home Assistant www folder as placeholder until your album art loads
## Change IP to match your Home Assistant instance below:
online_image:
- url: http://your.home.assistant.ip:8123/local/160x160.jpg
id: album_image
format: jpeg
type: rgb565
resize: 160x160
placeholder: holdplace
on_download_finished:
- lvgl.image.update:
id: albumart
src: album_image
- lvgl.label.update:
id: title
text:
format: "%s"
args: [ 'id(sensor_media_title).state.c_str()' ]
- lvgl.label.update:
id: artist
text:
format: "%s"
args: [ 'id(sensor_media_artist).state.c_str()' ]
## Change IP to match your Home Assistant instance below:
image:
- file: http://your.home.assistant.ip:8123/local/160x160.jpg
type: rgb565
id: holdplace
resize: 160x160
font:
- file:
type: gfonts
family: Montserrat
weight: 500
id: my_font
size: 14
bpp: 4
glyphs:
'${font_glyphs}'
color:
- id: black
hex: '000000'
- id: white
hex: 'ffffff'
spi:
clk_pin: 7
mosi_pin: 6
display:
- platform: ili9xxx
id: s3_box_lcd
model: S3BOX
data_rate: 40MHz
cs_pin: 5
dc_pin: 4
reset_pin:
number: 48
inverted: true
update_interval: never
invert_colors: false
i2c:
- id: bus_a
sda: GPIO08
scl: GPIO18
scan: true
sda_pullup_enabled: true
scl_pullup_enabled: true
frequency: 100kHz
- sda: GPIO41
scl: GPIO40
scan: true
sda_pullup_enabled: true
scl_pullup_enabled: true
frequency: 50kHz
id: bus_b
touchscreen:
- platform: gt911
i2c_id: bus_a
address: 0x5D
id: gt911_touchscreen
interrupt_pin:
number: GPIO3
ignore_strapping_warning: true
binary_sensor:
###### top left hand physical button #######
- platform: gpio
id: top_left_button
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: true
ignore_strapping_warning: true
# ####### red circle home button #####################
- platform: gt911
id: home_button
index: 0
###### radar sensor ######## # remove for no sensor version
# - platform: gpio
# pin:
# number: GPIO21
# name: "Presence detect"
# disabled_by_default: false
# device_class: "occupancy"
lvgl:
displays:
- s3_box_lcd
default_font: my_font
pages:
- id: main_page
widgets:
- obj:
align: CENTER
width: 320
height: 240
x: 0
y: 0
bg_color: black
border_color: black
text_color: white
scrollable: false
layout:
type: FLEX
flex_flow: COLUMN_WRAP
flex_align_main: CENTER
flex_align_cross: CENTER
widgets:
- image:
id: albumart
align: CENTER
src: holdplace
- label:
id: title
align: CENTER
text_align: CENTER
long_mode: SCROLL
text: 'Media Title'
width: 300
- label:
id: artist
align: CENTER
text_align: CENTER
long_mode: SCROLL
text: 'Media Artist'
width: 300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment