Building a Real-Time Washing Machine Status Website with Home Assistant, Docker, and FastAPI

I am building a website that will display the current status of a washing machine automation that I have set up in Home Assistant. The automation sends a notification when the washing machine finishes its cycle. I want the website to show whether the washing machine is “running” or “finished”. My Home Assistant and website are both running in Docker containers on an Intel Nuc. I am considering using FastAPI as the web framework for my server and am wondering if this is the most appropriate approach. As a pseudo code, the process would be as follows:

  1. Washing machine starts a wash cycle
  2. This triggers an automation in Home Assistant that sends a notification
  3. The notification triggers a webhook in Home Assistant
  4. The webhook sends a request to the server
  5. The server updates the database with the current state of the washing machine (e.g. “running”)
  6. The server sends a websocket message to the website with the updated state
  7. The website receives the websocket message and updates to reflect the current state of the washing machine (e.g. “running”)

Using FastAPI as a web framework for my server could be a good approach, as it allows me to build a web server with minimal overhead. I’m thinking I may not need a backend or storage persistence depending on the complexity.

Has anyone done stuff like this before, and is this a good approach?