Hello, could someone tell me what is wrong with this code?
I went through Display Component — ESPHome and Font Renderer Component — ESPHome several times and couldn’t figure out why I’m getting the error
i2c:
sda: 5
scl: 4
scan: true
font:
- file: "fonts/Comic Sans MS.ttf"
id: my_font
size: 20
display:
- platform: ssd1306_i2c
id: oled
setup_priority: -100
model: "SSD1306 128x64"
address: 0x3C
pages:
- id: page1
lambda: |-
it.printf(3, 20, id(my_font), "Acqua Callidus");
INFO ESPHome 2024.7.0
INFO Reading configuration config/test.yaml...
Failed config
font: [source config/test.yaml:37]
not a valid value.
- file: fonts/Comic Sans MS.ttf
id: my_font
size: 20
Looks ok. Try to use file name without spaces. Just guessing, not sure.
Do You have no this font file Comic Sans MS.ttf
in fonts
directory ?
fonts
directory to be created in same place where YAML config placed.
Yes, I tried with a single word filename, like arial.ttf and all fonts are in the fonts directory alongside with the config yaml file
marco@arch-marco ~/Projects/esphome/config tree
.
├── fonts
│ ├── BebasNeue-Regular.ttf
│ ├── Comic Sans MS.ttf
│ ├── arial.ttf
│ └── slkscr.ttf
├── secrets.yaml
└── test.yaml
exocarnivore
(Kirill Fries-Raevskiy)
August 13, 2024, 5:18pm
6
Same problem:
font:
#- file: "gfonts://Roboto"
- file: fonts/Roboto-Thin.ttf
id: roboto
size: 12
exocarnivore
(Kirill Fries-Raevskiy)
August 13, 2024, 5:36pm
7
I find solution - you need to install “pillow==10.2.0” (with other versions of pillow I got same error)