I built a Tamagotchi that dies when my homelab goes down

My Mini PC hosts several homelab services, including Home Assistant, Jellyfin, Audiobookshelf, Calibre, Uptime Kuma, and more.It also hosts some local LLMs, and in recent weeks, one of these has been hogging so much RAM that it's brought down other services.I decided to set up a fun way to monitor my homelab using a cheap ESP32 board.

My Cheap Yellow Display is already hosting a Tamagotchi My Chair Goblin dies if I sit down for too long My Cheap Yellow Display (CYD) may be one of the most useful devices in my home, especially for the price.It's an ESP32 board with a built-in color touchscreen display, making it ideal for a wide range of projects.I use my CYD to quickly add music from Apple Music and Spotify discovery playlists to a custom playlist of my own just by tapping the screen.

I can then play through this playlist and, with another tap, add the artist's latest album to my library.It's helped me discover a lot of great music far more easily.I then added another feature to the CYD that displays a Tamagotchi.

The little character's health depends on how long I sit in my office chair, as measured by a presence sensor.If I sit too long, the character loses health and eventually dies, but if I get up regularly, the creature slowly evolves over time.Related My internet went down for hours before I noticed—so I built an internet status light with an ESP32 I know when my internet is on the blink.

Posts 2 By  Adam Davidson I thought the same concept could be useful for other things It seemed like a fun way to monitor my homelab So far, my Tamagotchi has helped me stand up much more often.The character only evolves if I stand up regularly each day for five days in a row, and when it dies, it goes back to its original form, so it gives me just enough incentive to keep getting up rather than starting from scratch.I wondered if I could use the same principle to monitor more than just how long I was sitting.

I've had some issues with my homelab recently, with a RAM-hungry container maxing out my Mini PC and causing other services such as Home Assistant to crash.I wanted a way to keep an eye on my homelab's RAM usage, but staring at a dashboard all day didn't seem that much fun.A Tamagotchi seemed like a much more entertaining idea.

Home Assistant supplies the necessary data The CYD watches the Proxmox entities that are already exposed I use the Proxmox VE integration in Home Assistant to monitor my homelab.It exposes a wide range of information about my virtual machines and containers in Proxmox, including CPU usage, memory usage percentage, disk usage, uptime, and more.This is exactly the data that I needed for my Tamagotchi.

Using ESPHome, my CYD subscribes to these Home Assistant entities, so it can see when a container has gone down or is using a significant amount of RAM.It also monitors the status of the Proxmox node itself, as well as the total amount of RAM being used across Proxmox.Since the information comes from Home Assistant, which is itself running in Proxmox, it also monitors whether Home Assistant can be reached at all, because if Home Assistant is down, none of the entities will be accessible.

Homelab failures impact my Tamagotchi's health I can also see the issues on the CYD Close The way that the Tamagotchi works is fairly simple.It starts with 100 health, and every 60 seconds it checks the values of the relevant entities from Home Assistant.Two consecutive readings are required to indicate a problem, so that the Tamagotchi doesn't lose health when the values change momentarily.

When one of the monitored containers or VMs is reported as off when it should be running, the Tamagotchi starts to lose health, its appearance changes, and the screen displays the name of the problematic VM or container.If the system RAM rises above 85%, the health also starts to fall, with a message showing the current RAM percentage.If Home Assistant becomes unreachable, the Tamagotchi rapidly loses health, with a message that the monitor connection has been lost.

Health continues to drop until the problem is fixed, or the Tamagotchi dies.It's easy to spot a problem, and the display indicates what it is.I can then open the Proxmox UI and try to solve the problem before it gets out of hand.

When the problem is fixed, the Tamagotchi returns to full health or hatches anew if it died.The number of deaths is also displayed on the screen.My Tamagotchi is dumb, but it does help spot problems The whole idea of using an animated character to monitor my homelab is pretty dumb, but it really does work.

It's easy to see when something is wrong and what the issue is just by glancing at the CYD.I've been able to fix issues before they've brought down other services, which to my mind is a big win.

Read More
Related Posts