Going Lights Out: Building a Real-Time F1 Lighting System in my Smart Home (Part 1)
This is Part 1 of a three-part series on how I built a real-time lighting system for my smart home that reacts to live Formula 1 races. In this part, I’ll cover the spark of the idea and the frustrating search for a solution. In future parts, we’ll dive into the Python code and the final Home Assistant configuration
This spring I got a couple of new obsessions: Setting up my own HomeLab server! It was quite the sudden obsession that I jumped on, but before I knew it I had a mini-PC with a full fledged home server running; all of this definitely a story for another time! But by far one of the best setup: Home Assistant!
Suddenly we only need 1 app to control all (™) smart devices in our home; no more “app fatigue” of slow apps trying to remember “which had the bathroom lights again?!”. Scaling the smart home was now no longer locked behind “which app we already have”. We could finally start looking for the devices we needed for the prices we felt were fair. Before long I had custom dashboards made, individual spotlights grouped into fixtures. Automations set up to ease the day to day life, and scripts written to avoid repetition.
It was then during my second obsessions, Formula 1, that I had a bit of a (smart) light bulb moment: With all of this setup now, all under my own control, why isn’t my home able to react to what is happening on the TV? When Max takes pole the lights should switch to Red Bull colors, if there’s a safety car the lights should turn yellow and when we get a red flag interruptions the lights should flash red! That started me on an exploratory route to see: what already exists, and how hard is it to implement it?
As it turned out, this was not at all as simple as I had initially thought.
Don’t get me wrong, the Home Assistant community is truly amazing. I dove through forums and plugins, finding brilliant solutions and setups at every turn. There were custom dashboards for the F1 Grid and standings, custom sensors that integrated perfectly into the HA ecosystem, and even someone who made a HA device that shows the timing and date for the next race on a small e-ink display! The creativity was endless, but they all lacked the one thing I was looking for: Live connection to the current race I was seeing on screen.
From here I realised that I had to look a bit outside “pure” HA setup, I started looking for external services. I was digging through countless fan-made F1-projects, and again I was blown away by the ingenuity of the F1 fanbase. But I kept hitting the same wall: No one solution that fit my simple need. Even when I looked into doing “all the work” myself, using my own PC to follow, process and queue events, the best option was the OpenF1 API which had just put their live feed behind a paywall.
It was a dead end. I was genuinely starting to give up, reasoning that F1 would never let this kind of real-time data be available for free. I resigned myself to that fate and started instead half automating the setup with pre-made buttons to trigger the events myself.
And that was when I found it.
Buried deep in the documentation for another Python API called FastF1: A command that would be the key to my entire project.
I thought the hardest part was over, I was wrong... In Part 2, I’ll explain the strange world of broadcast delays, string parsing live data and the code I wrote to finally tame them. Want to sneak peak the results already? Check out the GitHub repository here