Scenes Manager - Intelligent ambiance manager for Glad

**The context

Note :** This was the last thing I was doing, after that I’ll leave you alone, sorry for the flood of the last few days. But I wanted to close this home automation migration because afterwards I won’t have much time to take care of it.

When migrating from Home Assistant to Gladys, one of my biggest challenges was managing lighting scenes. I have 22 lights on 4 different protocols (Philips Hue, Z-Wave, MQTT, Tuya) and I wanted scenes that adapt to the time of day and the weather.

Gladys scenes allow controlling lights, but as soon as you want to manage variants (warmer colors when it’s gray, different ambiance day/night), it quickly becomes complex with many scenes to maintain.

So I created a Scenes Manager: a lightweight Docker container (~25 MB RAM) with a web interface that:

  1. Captures the state of your lights in one click — all protocols, via the Gladys API

  2. Stores presets with adaptive variants (day/night, weather)

  3. Applies the right variant automatically when a Gladys scene calls it

How it works

Scene Gladys (trigger heure, presence, bouton, etc.)
  └→ Action \"HTTP Request\" : POST http://localhost:8890/scenes/soiree-chambre/apply
       └→ Scenes Manager
            ├─ Check : jour ou nuit ? (calcul local)
            ├─ Check : clair ou couvert ? (OpenWeatherMap, cache 10 min)
            └─ Applique la bonne variante via l'API Gladys

The key point: the Scenes Manager knows no protocols. It goes through the Gladys API (POST /api/v1/device_feature/{selector}/value). If Gladys manages your light, the Scenes Manager manages it too.

Separation of responsibilities: Gladys decides when, the Scenes Manager decides how.

Tested protocols

Protocole Status
Philips Hue OK (on/off, brightness, color, temperature)
Z-Wave (Fibaro Dimmer) OK (dimmer 0-99)
MQTT custom OK (on/off, brightness, color)
Tuya OK (on/off)

Performance

Operation Time
Capture 20 devices ~80 ms
Apply 6 Hue in parallel ~70 ms

Negligible — it’s the same code path as native Gladys scenes.

Installation and documentation

Everything is on GitHub with the complete README, installation instructions, the API reference and screenshots.

GitHub — gladys-scenes-manager

In short:

  1. Clone the repo

  2. docker build -t scenes-manager .

  3. docker run with your presets.json (Gladys API key config + GPS coordinates)

  4. Open http://YOUR_IP:8890

  5. Capture your ambiances, call them from Gladys scenes via « HTTP Request »

Stack

  • Node.js 22 Alpine, 2 dependencies (mqtt.js, suncalc)

  • Frontend vanilla (HTML/CSS/JS), dark theme inspired by Gladys

  • No framework, no database — a JSON file

4 Likes

That looks great!

Do you have a photo or two to show us of the result?

I’m having trouble seeing what it looks like. Which color do you choose depending on the lighting/weather?

Hi!

What exactly are you talking about, the actual lights? Because for the interface, I added screenshots.

But the idea:

You set all your lights however you want, either from Gladys or from the apps of your connected devices.

And the plugin lets you save the scene in 2 clicks. And for each scene, you can define variants depending on day/night or cloud cover. So for the scene you’ll set these parameters, and you’ll be able to create several presets for the same scene.

Example:
I have a room that’s kind of my geek room where I work and also play because I’m an avid gamer. When I turn on the PC, I call up the scene I made for the room. Depending on whether it’s dark or bright, the colors will be different. And if it’s a rather dark day, they’ll be warmer colors, and on a rather bright day, cooler colors.>

And above all, even without using variants, it’s still super simple to create scenes with multiple lights. Because otherwise, if you do it directly in Gladys’s scene editor, you’ll quickly end up with lots of blocks, since you need one to turn on, one for color and one for brightness for each light.

I don’t know if that’s clearer?

Yes, what it looks like in real life or how you make your choices. Actually, I absolutely don’t have an eye for graphics/aesthetics and I’m curious to know which colors you use at which moments. For example, on a rainy day, which color do you use?

To be honest, I don’t know yet, I’m waiting for it to get dark :rofl:
I had made a similar system on Home Assistant but it had stopped working a long time ago. And I take a lot of inspiration from Philips Hue scenes. I copy the colors for the other devices.

1 Like

Scenes Manager v2.0 — Simplification : 3 modes instead of variants

Following usability tests, I simplified the variants system which was too complex in practice.

What changes

The old system combined 2 independent axes (day/night x clear/overcast), which resulted in up to 4 variants to capture per scene + a default. In reality, at night we don’t care about the weather — it’s dark outside in any case.

v2 replaces all that with 3 modes:

Mode Quand Logique
Night After sunset Weather ignored
Day — good weather Daytime + clouds < threshold Plenty of natural light
Day — bad weather Daytime + clouds > threshold Little natural light

And above all: no need to fill in all 3. If you only capture one mode, it applies all the time (implicit default). Add the others whenever you want, at your own pace.

New UI

The interface has been reworked to better match the Gladys style:

  • Centered content (less full width)
  • Better contrast between the background and the cards
  • Simple mode selector (3 buttons) instead of day/night + weather checkboxes
  • Badges on the cards to see at a glance which modes are filled

Automatic migration

If you already had scenes in v1, they are migrated automatically on container restart. Nothing to do.

Link

\\GitHub — gladys-scenes-manager
\\

2 Likes

This is all excellent, well done @David-Digitis, great use of Claude Code :slight_smile:

1 Like

Héhé merci, 3 mois d’auto formation et de tests, mais c’est une affaire qui roule maintenant. Incroyable l’avancée des IA argentiques. Quand tu sais les utiliser, configurer les skills, agents, environnements, tu n’as plus de limittes. Ces intégrations, c’est 1/100 de ce que j’ai fait en 3 mois. J’ai littéralement fait passer mon entreprise en V2 lol

Tu utilises ou pas encore fait le pas ?

Ah yes, it’s been a while :smiley: It’s my job after all!

I’m into windsurfing myself; I’ve made quite a few videos on the Gladys YouTube channel

The most recent one:

1 Like

Ah cool, I’ll go check that out!
I didn’t know about Windsurf, I’m on VS Code.

1 Like