This repository contains a Battery component for ESPHome to support the ESP32-S3 LILYGO T5 4.7" Plus E-paper display.
(Do not confuse it with the original ESP32-based Lilygo T5 4.7 board.)
This component was shoddily adapted from a component for the older board revision by vbaksa, so it definitely needs improvement.
To use the board with ESPHome you have to put quite a number of options in your esphome config, see the examples at https://github.com/nickolay/esphome-lilygo-t547plus
# ... required esp32, platformio_options configuration omitted for brevity ...
external_components:
- source: github://kaeltis/esphome-lilygo-t547plus
components: ["lilygo_t5_47_battery"]
sensor:
- platform: lilygo_t5_47_battery
id: battery_voltage
voltage:
name: "Battery Voltage"
- platform: template
name: "Battery Percentage"
id: battery_percentage
lambda: |-
// tweak values in mapping for calibration
// 4.1 = max voltage
// 3.3 = min voltage
float y = (id(battery_voltage).voltage->state - 3.3) * 100.0 / (4.1 - 3.3);
if (y < 100.0) { return y; } else { return 100.0; };