— 31 min read

Desk buddies are everywhere right now: little robots with two blinking eyes that sit next to your keyboard. Most of them are cute. Mine is also useful.
By day it's a touch dashboard for my house: solar output, battery, grid, heat pump. One swipe further it's a remote for my desk lamp. After five minutes without a touch it falls asleep into a pair of robot eyes. And those eyes have moods that come from my Home Assistant data. In my case that is the energy side of the house:
If several apply, the first one in this order wins: sleepy, angry, surprised, happy, sad. Otherwise it looks neutral.
Solar is just one input here. The mood logic is a few lines of C++, so you can hang it on whatever your Home Assistant knows: CO₂ in the room, a failing backup, rain tomorrow.
For me, a quick glance tells whether now is a good time to start the dishwasher. If the buddy looks grumpy, it isn't.

The buddy blinks, looks around and throws a suspicious look. One tap brings back the dashboard, another tap flips to the next page.
Everything runs on a single ESP32 board for about €15, configured in YAML with ESPHome. No Arduino sketch, no custom firmware build pipeline. I wrote most of the config together with Claude Code, which validated and compiled every change locally before I flashed it. More on that workflow at the end.
| Part | Notes |
|---|---|
| TZT 2.4" ESP32 display board, a "Cheap Yellow Display" (CYD) variant | ESP32-WROOM-32, 2.4" 320×240, ILI9342 driver, resistive XPT2046 touch, RGB LED, light sensor, USB-C, LiPo connector with charging. About €15; search for "TZT ESP32 2.4 inch LVGL". |
| USB cable + USB power supply | The board has USB-C. Mine runs on USB-C; you can add a LiPo battery to the connector on the board. Updates go over the air after the first flash |
| Case | None yet. Mine leans in a wireless phone charging stand on my desk. A 3D-printed case is coming in part 2 |
| Home Assistant | With the ESPHome Device Builder add-on |
| Data in Home Assistant | Anything you want to show. I use a solar inverter with a home battery, a heat pump, temperature/humidity sensors, a wallbox and a robot vacuum |
Which CYD do I have? There are several "Cheap Yellow Display" variants (2.4", 2.8", 3.5", different drivers). The pins and the display model below are for the 2.4" TZT board (ESPHome sees it as a plain ESP32 Dev Module). On another variant, check the display driver and the touch calibration first.
The first flash was the easy part: create a new device in the ESPHome Builder, plug the board in over USB and flash it from the browser with web.esphome.io, done. One catch: a USB-C to USB-C cable didn't work for me. Only the cable that came with the board did, with a USB-C adapter. If the browser doesn't see the board, try another cable first. The fiddly part came after that: getting the display itself right, with the right driver, orientation and colour order (see the pitfalls below).
After the first flash, my workflow was always the same: edit deskbuddy.yaml, paste it into the ESPHome Builder in Home Assistant, click Install → Wirelessly. The device shows up in Home Assistant as deskbuddy-001 with its own entities (backlight, status LED, light sensor, brightness settings).
Keep your keys out of the YAML. Everything secret lives in the ESPHome secrets.yaml, and OTA updates reuse the API key, so plaintext uploads are refused:
api:
encryption:
key: !secret deskbuddy_api_key
ota:
- platform: esphome
# Bare encryption: reuses the API key
encryption:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: Deskbuddy 001 Fallback Hotspot
password: !secret deskbuddy_fallback_passwordOne more block worth copying: the ESPHome compile log suggests a few framework options for this chip. With them the firmware gets smaller and LVGL gets more fast RAM:
esp32:
variant: esp32
framework:
type: esp-idf
advanced:
minimum_chip_revision: "3.1"
sram1_as_iram: true
flash_chip: genericminimum_chip_revision: "3.1" only works if your ESP32 actually is revision 3.1 or newer. ESPHome prints the revision in the log on the first boot, so check before you set it.
This is the hardware block for the 2.4" CYD. Three settings cost me time, all are commented:
spi:
id: spi_bus
clk_pin: GPIO14
mosi_pin: GPIO13
miso_pin: { number: GPIO12, ignore_strapping_warning: true }
display:
- platform: mipi_spi
id: main_display
model: ILI9342
spi_id: spi_bus
data_rate: 40MHz
cs_pin: { number: GPIO15, ignore_strapping_warning: true }
dc_pin: { number: GPIO2, ignore_strapping_warning: true }
# The ILI9342 model defaults to BGR. On my panel that swapped red and blue.
color_order: rgb
# Gamma curve that ESPHome ships for the CYD with ILI9342
# (model "ESP32-2432S028-9342"). The default curve breaks the grey ramp.
init_sequence:
- [0x26, 0x01]
- [
0xE0,
0x00,
0x0C,
0x11,
0x04,
0x11,
0x08,
0x37,
0x89,
0x4C,
0x06,
0x0C,
0x0A,
0x2E,
0x34,
0x0F,
]
- [
0xE1,
0x00,
0x0B,
0x11,
0x05,
0x13,
0x09,
0x33,
0x67,
0x48,
0x07,
0x0E,
0x0B,
0x23,
0x33,
0x0F,
]
auto_clear_enabled: false
update_interval: never
dimensions:
width: 320
height: 240
# Rotate by 180° in the display block (the board stands upside down in my setup)
transform:
swap_xy: false
mirror_x: false
mirror_y: true
touchscreen:
- platform: xpt2046
id: main_touch
spi_id: spi_bus
cs_pin: GPIO33
interrupt_pin: GPIO36
calibration:
x_min: 225
x_max: 3835
y_min: 290
y_max: 3885Colours were the longest fight on this board, so the config has a color test: a switch in Home Assistant that shows six pure colours and a grey ramp from 0 to 100 %. If the red patch isn't red, flip color_order. If the dark greys look bright or bluish, the gamma curve is off. ESPHome already ships a matching curve for the CYD with the ILI9342 (the model ESP32-2432S028-9342). I only had to copy its init_sequence over, since I keep the plain ILI9342 model for its other defaults.

ESPHome can subscribe to any Home Assistant entity. Every value updates an LVGL label directly, no polling:
sensor:
- platform: homeassistant
id: pv_power
entity_id: sensor.solar_power
internal: true
on_value:
- lvgl.label.update:
id: pv_power_label
text: !lambda 'return std::isnan(x) ? std::string("--") : str_sprintf("%.1f", x / 1000.0f);'The grid sensor does a bit more. It also drives the RGB LED on the back (green while exporting, red on high import), and it stores that state so the face can reuse it later:
# Positive = import from grid, negative = export
- platform: homeassistant
id: grid_power
entity_id: sensor.grid_power
internal: true
on_value:
- lambda: |-
constexpr float EXPORT_THRESHOLD_W = -100.0f;
constexpr float HIGH_IMPORT_THRESHOLD_W = 1500.0f;
int mode = 0; // 0 = off, 1 = exporting, 2 = high import
if (!std::isnan(x)) {
if (x < EXPORT_THRESHOLD_W) mode = 1;
else if (x > HIGH_IMPORT_THRESHOLD_W) mode = 2;
}
id(status_led_mode) = mode;
// ... set the LED colourTip: For a Home Assistant
binary_sensor, addtrigger_on_initial_state: true. Otherwise the label shows--after every reboot until the state changes for the first time.
The UI is built with LVGL, which is part of ESPHome. Four pages (the labels on my display are German, so that's what you'll see in the photos):

My first version had three buttons at the bottom, one per page. They ate a strip of an already small screen and pulled the eye away from the data. With only a handful of pages you don't need to jump to one directly; flipping through is fine, and swiping or tapping feels like a phone anyway. So the buttons went. Now there's only a row of page dots as an indicator, and you switch pages by swiping or tapping.
Swiping works, but not well on a small display standing on a desk: you push it over or it slides away. So I added taps: tap the left half for the previous page, the right half for the next one. On the eyes, a tap anywhere wakes the dashboard. After 30 seconds without a touch the pages cycle every 10 seconds.
Tapping turned out to be trickier than swiping. LVGL reports an extra click at the end of every swipe, so one swipe switched two pages. The fix is to ignore clicks that end a gesture:
script:
- id: handle_page_tap
then:
- if:
condition:
lambda: |-
lv_indev_t *indev = lv_indev_active();
return indev != nullptr && lv_indev_get_gesture_dir(indev) == LV_DIR_NONE;
then:
- if:
condition:
lambda: |-
lv_point_t point;
lv_indev_get_point(lv_indev_active(), &point);
return point.x < lv_display_get_horizontal_resolution(nullptr) / 2;
then:
- script.execute: show_previous_page
else:
- script.execute: show_next_pageThe cards on the pages are set to clickable: false, otherwise they swallow the tap before the page sees it.
The fourth page talks back to Home Assistant. Buttons call a Home Assistant action, so the buddy needs "Allow the device to perform Home Assistant actions" turned on in the device options. The slider only sends when you let go, so dragging it doesn't flood Home Assistant with calls:
- slider:
id: desk_light_slider
min_value: 1
max_value: 100
# Dragging the slider must not count as a swipe to the next page
gesture_bubble: false
on_release:
- homeassistant.action:
action: light.turn_on
data:
entity_id: ${desk_light}
brightness_pct: !lambda return to_string((int) x);gesture_bubble: false was the one line that mattered: without it, every horizontal drag on the slider also flipped the page. Taps are less of a problem: buttons and the slider are clickable, so they take the tap themselves, and only taps on the empty card areas reach the page and flip it.
The white tones are three buttons. Each one sends a colour temperature:
- button:
id: desk_light_warm
on_click:
- homeassistant.action:
action: light.turn_on
data:
entity_id: ${desk_light}
color_temp_kelvin: "2700"Neutral and cold are the same with 4000 and 6500. The other way round, the buddy subscribes to the lamp's state, brightness and color_temp_kelvin, so the button and the slider also follow when someone switches the lamp in the app.
The face is a separate LVGL page with skip: true, so it's not part of the normal page cycle. It appears after 5 minutes without a touch. A tap brings back the dashboard. The BOOT button on the board (GPIO0) toggles the face directly, which is great for showing it off.
binary_sensor:
- platform: gpio
id: boot_button
internal: true
pin:
number: GPIO0
inverted: true
mode: { input: true, pullup: true }
ignore_strapping_warning: true
filters:
- delayed_on: 30ms
on_press:
- if:
condition:
lambda: "return id(face_visible);"
then:
- lvgl.page.show: energy_page
else:
- lvgl.page.show: face_page(Holding BOOT while plugging in still puts the ESP32 into flash mode, so this doesn't break anything. RST can't be used, it's wired to reset.)
No images, just LVGL objects:
# Pupils jump to one of 10 directions (4x centre); the eyes follow by 30 %
- id: face_glance
then:
- lambda: |-
static const int8_t GAZE_X[] = {0, 0, 0, 0, -1, 1, -1, 1, 1, -1};
static const int8_t GAZE_Y[] = {0, 0, 0, 0, -1, -1, 1, 1, 0, 0};
const uint32_t direction = random_uint32() % 10;
id(face_gaze_dx) = GAZE_X[direction] * ${gaze_x_px};
id(face_gaze_dy) = GAZE_Y[direction] * ${gaze_y_px};
- lvgl.widget.update:
id: [pupil_left, pupil_right]
x: !lambda "return id(face_gaze_dx);"
y: !lambda "return id(face_gaze_dy);"
- lvgl.widget.update:
id: left_eye
x: !lambda "return -${eye_offset_x} + id(face_gaze_dx) * 3 / 10;"
y: !lambda "return ${eye_offset_y} + id(face_gaze_dy) * 3 / 10;"
# ... same for right_eyeBlinking is just shrinking the eye height in three steps:
- id: face_blink
mode: single
then:
- lvgl.widget.update: { id: [pupil_left, pupil_right], hidden: true }
- lvgl.widget.update: { id: [left_eye, right_eye], height: 45 }
- delay: 40ms
- lvgl.widget.update: { id: [left_eye, right_eye], height: 5 }
- delay: 80ms
- lvgl.widget.update: { id: [left_eye, right_eye], height: 45 }
- delay: 40ms
- script.execute: face_apply_moodHere's the part that makes it mine. Once per second, a script picks the mood. The order is the priority. Moods and thresholds are substitutions at the top of the config:
substitutions:
mood_neutral: "0"
mood_happy: "1"
mood_angry: "2"
mood_sleepy: "3"
mood_sad: "4"
mood_surprised: "5"
face_surprised_load_w: "6000"
face_sad_battery_pct: "10"- id: update_face_mood
then:
- lambda: |-
constexpr int LED_EXPORT = 1; // set by the grid sensor (below -100 W)
constexpr int LED_HIGH_IMPORT = 2; // set by the grid sensor (above 1.5 kW)
const float house_w = id(house_power).state;
const float battery_pct = id(battery_soc).state;
int mood = ${mood_neutral};
if (id(night_time).state) mood = ${mood_sleepy};
else if (id(status_led_mode) == LED_HIGH_IMPORT) mood = ${mood_angry};
else if (!std::isnan(house_w) && house_w > ${face_surprised_load_w}) mood = ${mood_surprised};
else if (id(status_led_mode) == LED_EXPORT) mood = ${mood_happy};
else if (!std::isnan(battery_pct) && battery_pct < ${face_sad_battery_pct}) mood = ${mood_sad};
if (mood == id(face_mood)) return; // only redraw on change
id(face_mood) = mood;
id(face_apply_mood).execute();night_time is a template binary_sensor that checks the Home Assistant time against 22:00 and 06:30. The same sensor also caps the display brightness at night.
Each mood is eye size plus black shapes on top of the eyes, which act as lids:
| Mood | When | Look |
|---|---|---|
| Sleepy | 22:00–06:30 | heavy lids, "Z z z" |
| Angry | grid import > 1.5 kW | lids slant down towards the nose |
| Surprised | house load > 6 kW | tall, narrow eyes |
| Happy | exporting > 100 W | cheeks push up, eyes look up, a smile |
| Sad | battery < 10 % | lids slant down to the outside |
| Neutral | otherwise | squares |
Happy was the hardest one. My first version squashed the eyes flat and hid the pupils, which read more like "tired" than "happy". Now the pupils stay, they look slightly up, a black circle pushes up into each eye from below like a cheek, and a thin white arc underneath is the smile. That last part is the only mouth the buddy has, and it only shows up when the sun is paying the bills.
Waiting for a sunny afternoon or midnight to see a mood gets old quickly. So there's also a select entity "Face mood" in Home Assistant: on "Auto" the house decides, any other option shows that mood right away. Handy for demos, and for taking the photos below.

The CYD has a light sensor (LDR) on GPIO34. I hoped for smooth auto brightness. Reality: in a normally lit room the sensor sits at the bottom of its range (0.075 V). Covering it with a finger gives about 0.085 V. A flashlight changes nothing. So it can only tell "dark" from "not dark".
What works: the sensor dims the display in a dark room, and a time window caps brightness at night. Day and night maximum are two number entities, so I can tune them in Home Assistant without reflashing.
ILI9342 model assumes BGR. My orange bar was blue. Fix: color_order: rgb.ILI9342 model, which doesn't fit this panel. Fix: the CYD gamma curve from ESPHome as init_sequence (see step 2). The color test switch shows the difference in one second.0x000000) backgrounds, pure white text and Roboto 700 instead of 500 for small sizes. Later it turned out that most of the bluish grey came from the wrong gamma curve (item 2). The black-and-white style stayed anyway: it's the most readable on a small TN panel, and it looks good.rotation in the display block. I rotate with transform instead. If your swipes are reversed afterwards, mirror the touchscreen as well.glyphs:) brought flash usage from 70.7 % down to 64.3 %.Hardware isn't new to me. Years ago, long before the AI hype, I soldered, programmed and flashed my own weather stations for the house on a Wemos D1 Mini, wired up with MQTT and everything that comes with it. ESPHome didn't even exist back then. I could have written all of this by hand, and honestly, I tend to, because I can.
But as a solo founder I have to watch where my time goes. This is a fun project for my desk, not a customer project or one of my SaaS products, and nothing breaks if a blink looks odd. So I let Claude Code do the typing and spent my time on the part I enjoy: deciding how it should look and behave.
Funny detail: I had never used ESPHome before. I picked it on purpose because it's the simplest way to get an ESP32 into Home Assistant, and simple is what you want when you build together with an AI. I understand what every block in the YAML does. What I didn't have was weeks of reading docs, forum threads and component details. That's where Claude Code saved the most time. My job was to review every change, understand it, and make sure nothing ended up in there that I didn't want.
What made the first version a one-day project was the loop:
esphome config and esphome compile locally, so I only flash configs that build.The photos were the key. Most bugs on this device are visual, and a phone photo of the screen was the fastest bug report.
Honestly, I'm surprised and happy how fast this went. The whole face, from "can it show eyes?" to six moods, took less than an hour. The colour fix, the new happy face and the lamp page came a few evenings later, each in a short session. The trick isn't the AI itself. It's getting into it and figuring out how to work with it: short loops, clear feedback, and a photo instead of a long description.
The complete deskbuddy.yaml is on GitHub: pr0gstar/Buddies. Your keys go into your own secrets.yaml; the repo has a secrets.yaml.example to start from.
The entity IDs in this post and in the config are generic examples (sensor.solar_power, sensor.grid_power, …). Replace them with your own, and change the thresholds under substitutions (idle times, eye size, mood thresholds).
Right now my buddy leans in a wireless phone charging stand that was lying around. That's fine for a prototype, but not where I want it to end up. For part 2 I'm planning:
I'll write that up as a follow-up once it's built.
The board sat in my workshop for about two days before I started. After that it went fast. Now it's the first thing I look at when I sit down: are we exporting, is the battery fine, is the heat pump OK? And when nobody touches it, it just sits there, blinks and looks around.
What I like most is how fast this went. One YAML file, a Home Assistant you probably already run, and a lot of small "hm, that looks wrong" moments with a phone camera. If you've never built anything with a display before, this is a great first project: no soldering, one board, and you see every change right away.
It's not finished. The eyes still jump instead of glide, and the whole thing still looks like a dev board in a phone stand. That's what part 2 is for.
If you build one, show me on X: @pr0gstar. I'd love to see what mood yours is in. And if you want to know when part 2 is out, follow me there, that's where I'll post it first.