I’m setting up my new LilyGo T5 4.7 in e-ink display but am having issues with my centered text aligning to the right edge of the screen instead of the actual center. I’m new to ESPHome and would greatly appreciate any assistance.
Here’s what I’m seeing:
Here’s my YAML:
substitutions:
esp_name: clock
esphome:
name: clock
friendly_name: clock
platform: esp32
board: esp32dev
platformio_options:
upload_speed: 1500000
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
ota:
password: !secret ota_pass
captive_portal:
time:
- platform: sntp
id: ntp
button:
- platform: restart
name: "${esp_name} Restart"
- platform: template
name: "${esp_name} Refresh"
icon: "mdi:update"
on_press:
then:
- component.update: t5_display
binary_sensor:
- platform: gpio
pin:
number: GPIO39
inverted: true
name: "${esp_name} Button 1"
on_press:
then:
- component.update: t5_display
- platform: gpio
pin:
number: GPIO34
inverted: true
name: "${esp_name} Button 2"
- platform: gpio
pin:
number: GPIO35
inverted: true
name: "${esp_name} Button 3"
sensor:
- platform: adc
pin: GPIO36
name: "${esp_name} Battery Voltage"
id: batt_volt
attenuation: 11db
update_interval: never
filters:
- multiply: 2
- platform: template
name: "${esp_name} Battery"
id: batt
unit_of_measurement: "%"
accuracy_decimals: 0
device_class: battery
lambda: |-
int y = (1-(4.1-id(battery).state)/(4.1-3.3))*100;
if (y < 100) {return y;} else {return 100;};
- id: battery
platform: lilygo_t5_47
internal: True
font:
- file: "gfonts://Roboto"
id: font_big
glyphs: "+-0123456789.:"
size: 300
- file: "gfonts://Roboto"
id: font_med
size: 100
- file: "gfonts://Roboto"
id: font_tiny
glyphs: "+-0123456789.:"
size: 25
external_components:
- source: github://ashald/esphome@lilygo-t5-47
components:
- lilygo_t5_47
display:
- platform: lilygo_t5_47
id: t5_display
rotation: 0
update_interval: 60s
full_update_every: 5
lambda: |-
it.print(10, 150, id(font_med), TextAlign::CENTER, "Current Status");
//Divider
#define div_pad 40
#define div_thickness 4
it.filled_rectangle(50, 270, 860, div_thickness);
it.printf(10, 400, id(font_med), TextAlign::CENTER, "Battery %.0f%%", id(batt).state);