Updating ESPHome Devices Sequentially with Home Assistant Scripts

Why I Needed Sequential Updates I maintain 20‑plus ESPHome nodes on a small ARM‑based Home Assistant server. Each OTA update forces a full C++ compile, which can take ≈ 5 min per device. Two compiles at once, however, balloon the total wall‑time (CPU contention + I/O) and can push the server to its limits. I opened esphome/feature‑requests #2171 asking for a shared build‑cache across devices—because most of my YAML files differ only in pin mappings. If the cache wasn’t per device, maybe I could have kicked off all devices at once, or even used esphomes own “update all” as it had its own issues with not being able to run for hours and hours. Until that feature lands, the workaround has been to update devices strictly one after another. ...

May 12, 2025 · 4 min · Michael Bisbjerg

Smart Refresh Schedule for Sensors in Home Assistant

Polling a sensor at a fixed interval — say, every 5 minutes — is simple to set up. But in practice, it can be wasteful or inadequate: polling too often wastes bandwidth and may hit rate limits, while polling too slowly can leave your data stale when you need it most. Ideally, we’d poll frequently when someone might be watching, and rarely (or not at all) when the house is asleep or empty. That means dynamic polling based on context. ...

May 9, 2025 · 4 min · Michael Bisbjerg

Using dmsetup to Salvage Disks with Bad Blocks

Introduction I have a disk with bad blocks. The filesystem I’m using (such as ZFS) doesn’t support marking bad blocks like ext did, and completely replacing the disk is costly and unnecessary. Instead, I’ve used dmsetup to create a virtual disk that excludes the bad sectors, allowing the filesystem to work with the remaining good areas. This guide covers the process of scanning the disk, preparing a custom partition, setting up dmsetup, and ensuring everything works across reboots. I’ve additionally included steps to ensure that the dmsetup configuration follows the disk, ensuring you don’t loose that critical piece of information. ...

April 7, 2025 · 9 min · Michael Bisbjerg

WLED Backup script

ℹ️ Info: This post was linked in the WLED discussions and the script may make it to the WLED project. Introduction WLED is a powerful open-source solution for controlling addressable LEDs over Wi-Fi, making it popular for DIY smart lighting projects. However, maintaining backups of your WLED configurations can be tedious, especially when managing multiple devices. In this post, I’ll demonstrate a simple bash-based backup solution that discovers WLED devices on your network, pulls their configurations, and saves them locally for easy restoration. The scripts are intended for Linux-based systems and can be scheduled with cron for fully automated backups. ...

March 28, 2025 · 4 min · Michael Bisbjerg

Entity Framework Core: Querying views, but manipulating tables

I had a use case for EF Core where I wanted to query a database view while still supporting classic add/update/delete methods on the base table. Specifically, I wanted to enrich entities with computed values, like a lookup or label, but allow full CRUD support. Example Problem Suppose we have two entities: Entity: (Id, DeviceId) Friendly: (DeviceId, FriendlyName) The goal is to filter Entity records by FriendlyName, even though it’s not part of the table directly. ...

June 8, 2023 · 2 min · Michael Bisbjerg