This project is specifically built for the Geekmagic SmallTV Pro display (ESP32 + ST7789 240x240) and shows electricity data from Home Assistant.
Current firmware stack in this repository:
- ESPHome
2026.3.3 - LVGL
8.4.0
esphome-pvpc.yaml configures the device with two pages:
- Hourly page: next 4 hourly prices with color bands (green/yellow/red).
- Dashboard page: live house power (W/kW) and current energy price (EUR/kWh) using dual arc gauges.
- Touch page switch: GPIO32 touch input toggles between both pages.
- Runtime tuning: threshold values are exposed as template numbers in Home Assistant.
- UI is implemented with LVGL pages/widgets (not custom pixel drawing lambdas).
- Display driver uses
mipi_spi+ST7789Vat240x240, withcolor_depth: 16. - Dashboard arcs are native LVGL
arcwidgets with runtime updates from Home Assistant sensors.
- UI refresh runs periodically every
30s. - Dashboard values also refresh immediately on sensor update (
pvpc_current_priceandhouse_poweron_value). - Manual page switch triggers an immediate
refresh_uirun.
This means both screens keep their values warm in the background, and switching pages should show current data right away.
- ESPHome (Home Assistant addon or CLI).
- Home Assistant with ESPHome API enabled.
- Geekmagic SmallTV Pro hardware.
- One Home Assistant sensor with:
- current price as the sensor state.
- hourly price attributes named
price_00h...price_23h.
- One Home Assistant sensor for live house power.
By default, the YAML uses:
- Price sensor:
sensor.esios_pvpc_2 - Power sensor:
sensor.sensor_consumo_electrico_power
If your entities are different, edit esphome-pvpc.yaml in these blocks:
- Current price sensor (
sensor:block)
sensor:
- platform: homeassistant
id: pvpc_current_price
entity_id: sensor.esios_pvpc_2Replace sensor.esios_pvpc_2 with your own current-price entity.
- Power sensor (
sensor:block)
sensor:
- platform: homeassistant
id: house_power
entity_id: sensor.sensor_consumo_electrico_powerReplace sensor.sensor_consumo_electrico_power with your own power entity.
- Hourly price attributes (
text_sensor:block)
All hourly rows currently point to the same entity (sensor.esios_pvpc_2) and read attributes price_00h to price_23h.
Example entries:
text_sensor:
- platform: homeassistant
id: price_00h
entity_id: sensor.esios_pvpc_2
attribute: "price_00h"
- platform: homeassistant
id: price_01h
entity_id: sensor.esios_pvpc_2
attribute: "price_01h"If your integration uses a different entity or attribute names:
- change each
entity_idin thetext_sensor:block. - update every
attributename to match your integration output.
Tip: if your attributes are named differently (for example hour_00, hour_01, ...), update all 24 entries to keep the display logic consistent.
If you want to tune arc direction/placement/behavior, edit price_value_arc and power_arc in esphome-pvpc.yaml:
- geometry:
x,y,width,height - angle span:
start_angle,end_angle - direction:
mode(NORMAL/REVERSE) - orientation:
rotation - thickness/colors:
arc_width,arc_color,indicator.arc_width,indicator.arc_color
Runtime value mapping is done in refresh_ui:
lv_arc_set_value(id(power_arc), (int) (power_norm * 100.0f));
lv_arc_set_value(id(price_value_arc), (int) (price_norm * 100.0f));Where:
power_normcomes fromhouse_power / power_max_wprice_normcomes from(pvpc_current_price - price_min_eur) / (price_max_eur - price_min_eur)
- Copy
secrets.example.yamltosecrets.yaml. - Set your Wi-Fi credentials in
secrets.yaml. - Update Home Assistant entity IDs and attributes as described above.
- Optional: tune thresholds in the
number:section.
Example secrets.yaml:
wifi_ssid: "MyWiFi"
wifi_password: "MyPassword"As documented in the YAML comments:
- Import
esphome-pvpc.yamlin ESPHome Builder. - Build and use
Install -> Manual downloadto generate the.bin. - Flash that
.binfrom the Geekmagic web portal. - Once the device is online in ESPHome, deploy updates over OTA.
esphome-pvpc.yaml: main ESPHome configuration.assets/screenshots/: device screenshots used in documentation.secrets.example.yaml: local secrets template.secrets.yaml: local secrets file (gitignored).
secrets.yamlis ignored by.gitignoreto avoid publishing credentials.- Never commit real passwords, tokens, or API keys.
- Before pushing, review entity names and sensitive values in your commit history.
- This repository uses Conventional Commits (for example
feat: ...,fix: ...,docs: ...). - See
CONTRIBUTING.mdfor the full commit convention and examples.
This project is released under the MIT License. See LICENSE for details.

