Mood Controller: Giving Your Home a Rhythm with Home Assistant

I have two young kids, a four-year-old and an eighteen-month-old. If you’re a parent, you know that a home with small children is just chaos. Bedtime happens when it happens. If it does. Movie night interrupts everything. Someone wakes up at 5 AM, someone else sleeps until 7. The house needs to keep track.

When I first set up Home Assistant, I did what I suppose everyone does: I created scenes. Morning scene, evening scene, movie scene. For a while it felt like there might be something there, but they kept piling up as I discovered the family’s patterns. After trying to sequence those patterns, I understood what scenes actually are: bookmarks. Say my wife and I start bingeing a series late into the night. The last thing I want when the TV goes off is the living room lighting up all over again. I needed the living room to know that the house had moved into night mode — and to settle back into night, not into the evening it was in when the movie started.

That’s the gap I kept running into. Home Assistant is incredibly powerful at connecting devices and triggering automations. But it lacks any sort of algorithm that could read patterns of use and build a logic out of them. The thing needs to be alive — flowing through moods, with rooms that sometimes diverge from the whole and then gracefully rejoin it.

So I built Mood Controller: a modular system that gives Home Assistant what it was missing — a stateful rhythm that cascades from the house level down to individual rooms, while letting each room keep its own autonomy when it needs it.

Think of it as the “Apple touch” for Home Assistant. It just works the way you’d expect it to.

GitHub: github.com/ZeFish/hass_mood_controller


The Problem: A Missing Rhythm

Home Assistant is superb at connecting and automating devices, but it has no built-in notion of rhythm — no stateful scene management. The challenge shows up the moment you want to override a room’s lighting temporarily and then have it revert to whatever the house is doing now, rather than to whatever it was doing before.

Manual override is the other half of the problem. Out of the box, Home Assistant doesn’t really handle it: once you touch a light by hand, nothing tells the system whether you meant it. Mood Controller makes that intent explicit — a room you’ve overridden stays overridden, and it can even be protected from house-wide mood changes.

The result, from the outside, is just a standard IKEA switch. Press the top button to brighten the lights, the bottom one to turn them off. In either case, another press hands the room back to the rhythm of the house.

Just that. A Zigbee switch that finally behaves the way I expect. I turn on the lights, the house moves through all its phases without disturbing me, and when I leave the room, after five minutes with no motion, it finds its way back into the rhythm.


The Core: Moods and Presets

At its heart, Mood Controller embodies a state-centric hierarchical automation philosophy, where moods cascade from the house level down to individual rooms, yet each space retains the autonomy to maintain its own state when needed. The system uses minimal helpers that serve dual purposes as both configuration points and memory, ensuring your home can gracefully recover from any disruption.

The key insight is that family life operates on two levels simultaneously. The first level is the mood — the general ambiance of the home tied to the rhythm of the day. The second level is the preset — temporary overrides for specific needs within a room, without breaking the overall flow.

Scenes gave me the first level. What was missing was the second level: the ability to say “I need this room brighter right now, but when I’m done, bring it back to the mood of the house at the current time.”

Moods

These are high-level, home-wide scenes that define the general ambiance. They are the primary states of the home. You can create as many as you need. My personal implementation uses five principal moods tied to the time of day:

Presets

These are variations or modifications of a Mood, often used for manual control within a room without changing the underlying Mood. This allows for manual alternatives within the current mood without breaking the overall rhythm. My standard presets are:

This two-tiered system allows for both powerful, home-wide automation and intuitive, manual control via physical switches or dashboards.


How It Works

The mechanism behind this — a single mood_set entry point that resolves which
rooms to touch, respects manual overrides, groups them so the lights move
together, and dispatches to the right mood script — is a piece of architecture
in its own right. It has its own article:
Home Assistant Has No Functions. I Wrote a Dispatcher Anyway.

The complete setup instructions, service call examples, and mood script
templates live in the repository, where they can stay current:

github.com/ZeFish/hass_mood_controller


Practical Examples of Mood Rhythm

In my own home, I’ve created automations that define when moods change based on time, activity, and environmental data. This gives the house a rhythm that adapts fluidly throughout the day.

Here’s how my moods typically shift:

How the System Lives Throughout the House


Real-World Automation Examples

The true power of this system is unlocked through automation. Because the state of every room is always known and stored in helpers, you can create highly specific and intelligent automations.

Motion-Based Night Light

Turns on a dim light in the kitchen upon motion, but only if the kitchen is in the Night mood and default preset. When motion clears, it gracefully returns the room to the standard Night scene.

(Full YAML available in the GitHub repository.)

Movie Time

Locks the living room when the projector turns on. When media plays, it sets the living room into movie mode. After a 30-second pause, the living room syncs back with the home mood. When the projector turns off, the living room gets unlocked and returns to whatever mood the house is in now — not whatever it was when the movie started.

This is the automation that convinced me the system was working. The house moved from Evening to Night during a two-hour movie, and when I turned off the projector, the living room gently faded into Night — not back to Evening. That’s rhythm.

Morning Routine

Each room transitions to Morning individually as motion is detected. When all main rooms have reached Morning, the whole home officially shifts. This means if one parent is up early with the baby, the kitchen wakes up softly without blasting light into the bedroom where the other parent is still sleeping.

Children’s Room Lock

Automatically locks the children’s room during Night and Unwind moods, preventing home-wide transitions from accidentally lighting up a room where a child is sleeping. When the mood changes to something else, the room unlocks and syncs back with the home.


What I Learned Building This

Mood Controller started as a way to solve a lighting problem, but it taught me something bigger about how systems should work. The best automation isn’t the one that does the most — it’s the one you forget is there. When the house just feels right without anyone touching a switch, that’s when you know the system is working.

The architecture behind this — state hierarchies, dynamic dispatch, event hooks, area autonomy — isn’t specific to Home Assistant. It’s a pattern that applies wherever you need to manage complex, overlapping states in a system that serves humans. I’ve used the same thinking to build modular web frameworks and I’m starting to apply it to physical computing projects like automated growing systems.

If you’re a Home Assistant user frustrated by the limitations of scenes and scripts, I hope this gives you a foundation to build on. The full code, templates, and documentation are on GitHub:

github.com/ZeFish/hass_mood_controller

If you have questions, ideas, or improvements — open an issue or reach out. I’d love to hear how you adapt this to your own home’s rhythm.


Francis Fontaine is a developer and photographer based in Québec City. He builds modular systems for the web (stnd.build) and for the physical world, and believes the best technology is the kind that disappears into the background of daily life.

Are you absolutely sure?

This action cannot be undone.