Hello fellow!

Feel free to browse my coding related notes

How to build a remote temperature monitor with ESP32

There’s a garage I look after that sits empty most of the week. In winter the question is always the same: is it still warm in there, or did the heating fail? The garage has WiFi, but nothing else: no server, no port forwarding, no VPN, nothing that lets me connect in. I wanted two things: Anyone at the garage can open a page on their phone and see the current temperature and the last two weeks, without an app or a login. I get the data in my own Home Assistant at home, with history and a Telegram alert if the monitor goes silent. The solution is an ESP32 with a DS18S20 sensor running ESPHome. The board serves a read-only page on the local network and pushes its readings out to ThingSpeak, and Home Assistant reads them from there. All traffic is outgoing. ...

How to monitor a car's 12 V battery in Home Assistant with ESP32

My car is a Hyundai Ioniq 5. Like most EVs, it still has an ordinary 12 V battery, and that battery decides whether the car wakes up at all. If it’s flat, a full high-voltage pack doesn’t help: the car won’t go into ready mode. The 12 V battery is charged from the high-voltage pack, so a problem on that side can drain it without warning. I want to know the 12 V voltage every day, not only when the car refuses to start. ...

How to automate darts board lights with ESP32

My dartboard has its own light and a score display, both on Tapo smart plugs. I wanted them to turn on when I start throwing and off when I stop, without touching a switch or a phone. The solution is a vibration sensor on the board, an ESP32 running ESPHome, and two Home Assistant automations. Full source: github.com/artosalminen/esp32-vibration-sensor Hardware diymore ESP32-C3 board with a 0.42" OLED. Native USB-C and a built-in 72x40 SSD1306 display. SW-420 vibration sensor module. A spring vibration switch with an LM393 comparator, a sensitivity potentiometer and a digital DO output. Three Dupont jumper wires. A smart power strip for the light and display. I use a TP-Link Tapo P300, which has three individually switchable outlets. Through Home Assistant’s TP-Link Smart Home integration each outlet shows up in Home Assistant as its own switch, for example switch.office_p300_darts_board_light and switch.office_p300_darts_display, the entities used in the automations below. Wiring is three wires: ...

How I Built a Vehicle Cost Comparison Tool That Doesn't Ignore Depreciation

I was replacing a 2014 petrol MPV with a used EV. Along the way I collected insurance quotes, checked the vehicle tax bracket, asked for a battery health certificate, got a trade-in offer, and compared a cash price against a dealer’s financing plan. Somewhere in the middle of all that I wanted one simple thing: a single number telling me what switching would actually cost per year, compared to just keeping the car I already had. ...

How to Resolve Vitest `EMFILE: too many open files` Errors on a High Thread Count Machine

If you’re running your Vitest suite on a high thread count machine—like an 8-core or 16-core development machine—you may encounter a frustrating error that looks like this: EMFILE: too many open files This issue can be cryptic at first, especially when your system doesn’t seem anywhere near running out of resources. But the root cause might not be in your system limits—it could be in your import statements. The Unexpected Culprit: Named Imports from MUI In my case, after hours of digging, I discovered that the error was caused by using named imports from Material UI (MUI) components and icons. These named imports, when used across many test files, were triggering Vitest to open an excessive number of files behind the scenes. ...