{
  "id": 11424928,
  "title": "The coffee log, rebuilt in .NET",
  "url": "https://urgent.news/2026/10/02/the-coffee-log-rebuilt-in-net",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-02T11:24:10.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/owaincodes/the-coffee-log-rebuilt-in-net-25md"
  },
  "original_language": "en",
  "account": "The coffee log, rebuilt in .NET is a story of how the author replaced the Python script controlling their coffee machine with a .NET application. Initially, the Python script was written for a Raspberry Pi Zero and relied on pure Python, with careful consideration of library versions and installations. However, as the author upgraded to a 64-bit Raspberry Pi model, they realized that a self-contained .NET application could be published as a single binary, eliminating the need for external runtimes and package managers. This change made the project more manageable and easier to maintain.\n\nThe author found that maintaining the Python script became increasingly difficult, as they were no longer familiar with the code and had to re-learn it after a few months. Additionally, the Pi's upgrade to a 64-bit model opened up new possibilities, such as the ability to create a self-contained .NET application. This new version of the coffee log writes every detected brew to a JSON file on the Pi, which proves to be a valuable asset for analyzing coffee habits.\n\nOne of the main challenges the author faced was determining when a coffee machine starts and finishes brewing. Initially, the state machine had two simple rules: power going up indicates a brewing start, and power dropping indicates a brewing completion. However, this rule was not foolproof, as the machine occasionally logged coffees that were not brewed. To address this issue, the updated service now writes every detected brew to a JSON file and includes additional rules for detecting brew starts and finishes, minimum duration, and a cooldown period.\n\nThe author also highlights the importance of replay mode, which allows them to run the coffee detector using data from a CSV file instead of the actual plug. This feature enables them to test different settings and configurations without the need to brew actual coffee. The detector is designed to be interface-based, allowing it to accept readings from either the real plug or a CSV file. This flexibility makes it easy to swap between the two sources without affecting the downstream components.\n\nIn terms of wiring the coffee log back up to the website, the author uses a pluggable sink system, which allows them to choose how the data is processed and stored. Currently, they have a JSON file sink and an Umbraco sink, both of which write the data to their respective destinations. In the past, the Pi had a pending queue that kept retrying posts until the website responded, but this approach led to duplicate posts if the response got lost in transit. To avoid this issue, the .NET sink deliberately does not retry failed posts, treating them as missing posts that can be fixed manually. This approach ensures that only unique, correctly published coffees are displayed on the website.",
  "summary": "The coffee log, rebuilt in .NET Back in June I wrote about my coffee machine writing my blog . Smart plug watches the coffee machine, Raspberry Pi watches the plug, bit of Python tells Umbraco I've made a coffee. If you've not read that one, go and read it first, it covers the plug, the KLAP handshake, the controller on the site, all of it. None of that has changed. So why am I writing about it…",
  "key_points": [
    "Author replaces Python script with .NET application for coffee machine",
    "Python script difficult to maintain after Pi upgrade to 64-bit model",
    "JSON file sink and replay mode enable data analysis and testing"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}