Hi everyone, does anyone have a working code? I’m going in circles with the configuration of my SmallTV (green or blue motherboard). If someone could share a code that just displays “hello world,” I should be able to figure it out.
I fixed it, thanks to several other posts.
esphome:
name: smalltv
friendly_name: SmallTV
platform: ESP8266
board: esp01_1m
external_components:
- source:
type: git
url: https://github.com/rletendu/esphome.git
ref: st7789_nobuffer_202312
# refresh: 0s
components: [st7789v]
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret key_smallTV
ota:
- platform: esphome
password: !secret ota_smallTV
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Cash From Cahos"
password: "CFC_Rules_Since_69"
# Ici, on active le serveur WEB du ESP8266, en allant sur l'IP du ESP8266, on tombe sur une interface pour piloter les relais
web_server:
port: 80
auth:
username: !secret server_username
password: !secret server_password
captive_portal:
spi:
clk_pin: GPIO14
mosi_pin: GPIO13
interface: hardware
id: spihwd
# status_led:
# pin: GPIO2
time:
- platform: homeassistant
id: ha_time
output:
- platform: esp8266_pwm
pin: GPIO05
frequency: 40 Hz
id: pwm_output
light:
- platform: monochromatic
output: pwm_output
name: "Backlight"
font:
- file: "SFCompact.ttf"
id: roboto
size: 30
glyphs: 'éèà!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/'
display:
- platform: st7789v
model: "Custom"
spi_id: spihwd
height: 240
width: 240
offset_height: 0
offset_width: 0
# dc_pin: GPIO02
# reset_pin: GPIO04
dc_pin: GPIO00
reset_pin: GPIO02
#backlight_pin: GPIO25
eightbitcolor: True
#update_interval: never
update_interval: 30s
id: disp
spi_mode: mode3
lambda: |-
// Calculate the center positions
int center_x = it.get_width() / 2;
int center_y = it.get_height() / 2;
// Print "Hello World" centered
it.printf(center_x, center_y - 20, id(roboto), TextAlign::CENTER, "Hello World");
// Print the current time centered below "Hello World"
auto time = id(ha_time).now();
time_t time_t_value = time.timestamp;
char buf[9]; // Buffer to hold the time string
strftime(buf, sizeof(buf), "%H:%M:%S", localtime(&time_t_value));
it.printf(center_x, center_y + 20, id(roboto), TextAlign::CENTER, buf);
I created an ESPHome configuration for the low-end GeekMagic TV. It supports displaying three text pages with basic formatting and includes a notification service. The page rotation speed can be adjusted, and a specific page can also be set as fixed. It might not be completely bug-free, but it has been working well for me so far. I wrote it with a lot of help from Copilot.
Code is here: GeekMagic Display Small TV ESPHome Config · GitHub
I’ve made some updates to my ESPHome configuration for the low-end GeekMagic TV:
• Added support for five pages (up from three).
• Included a number input to set a max page for rotation.
• Implemented an error message if the sensor for the text isn’t set up in Home Assistant.
• Added more buttons and services to switch pages.
• Changed the font and font sizes.
• Improved the calculation for new lines, making it better and cleaner.
• Included a startup message since sensors from Home Assistant need to load before the first display.
• Added an action to update the display content whenever the sensor text value is updated in Home Assistant.
• Included a switch to activate/deactivate this last behavior.
These changes make the setup more flexible and user-friendly. Let me know what you think or if you encounter any issues!
I edit the code on the first post.
I’ve made some updates to my ESPHome configuration for the low-end GeekMagic TV:
- Removed Large Font and restricted glyphs the because the fonts needs to much of the ram
- Added two progress bars on top and bottom. The values are loaded from home assistant number sensors
- added a display buzzer for alarming
- changed the font rendering
- added the status led light
- changed the name schema for the home assistant sensors to make it easy to support more than one device
- Removed unnecessary sensors and the logger to save RAM.
- Added an option to create two columns on a page.
- Enabled displaying a page initially in the bottom right corner.
- Included the API key in the API configuration for potential REST API functionality (not thoroughly tested yet).
- Updated the web server GUI to a newer, more user-friendly version.
- Added sorting to the web server UI.
- Settings are now saved between reboots.
- Fixed issues with display and sensor updates.
- Notifications are now queued for better handling.
I edit the code on the first post.
For which version is this?
-smallTV
-PRO
-ULTRA
Not sure what the ULTRA version is, but it pops up from time to time [in the bundle-deals of Aliexpress]
Congratulations, Great job!!
I can show several HA sensors but I don’t understand how you can modify the size, position, color, etc.