L’IA ne sait qu’allumer ou éteindre une lumière
j’aimerais qu’on rajoute la gestion de la luminosité ex « luminosité de l’ampoule Salon à 30 % »
et aussi la variation de la température couleur ex « mets la température de couleur de la lumière bureau à « blanc froid » (6500 °K) ou « blanc neutre » (4000°k) ou « Blanc chaud » (2700 °K) »
réglage de la couleur : ex « lampe de la chambre en bleu »
Merci pour la demande !
C’est développé dans cette PR :
master ← cursor/ai-light-brightness-color-temperature-d88c
ouvert 09:44AM - 20 Jul 26 UTC
## Description
Implements the feature request from the community forum: [Concer… nant l'IA : luminosité/température/couleur d'une ampoule](https://community.gladysassistant.com/t/concernant-lia-luminosite-temperature-couleur-dune-ampoule/10352).
Until now the AI assistant could only turn lights on or off (`device_turn_on_off` on `light:binary` features). This PR adds a new `device.set-light` MCP tool (exposed to the AI chat as `device_set_light`) so the assistant can handle requests like:
- "Set the brightness of the living room bulb to 30%"
- "Set the office light to cool white (6500K) / neutral white (4000K) / warm white (2700K)"
- "Bedroom lamp in blue"
## Changes
- **`server/services/mcp/lib/selectFeature.js`**: new `isLightControlFeature` helper matching `light:brightness`, `light:color` and `light:temperature` features.
- **`server/services/mcp/lib/buildSchemas.js`**: new `device.set-light` tool (registered only when at least one light control feature exists):
- `brightness` as a percentage (0-100), normalized to the feature `min`/`max` range;
- `color` as a hex RGB string (with or without `#`), converted to the integer color value;
- `temperature` in Kelvin, converted to mired and clamped to the feature `min`/`max` range (same convention as the Google Actions ColorSetting trait);
- target selection by device name or by room (all lights of the room), mirroring `device.set-shutter`.
- Light control features are now also exposed in the `schema://home` resource and in `device.get-state`, so the AI can read the current brightness/color/temperature.
- **`server/services/mcp/lib/formatValue.js`**: `light:color` states are reported as hex colors (e.g. `#0000ff`) instead of a raw integer, which the model can interpret.
- **`server/config/prompts/aiChat.prompt.txt`**: prompt rule directing the model to `device_set_light` for brightness/color/temperature requests.
## Tests
- New tests in `server/test/services/mcp/lib/buildSchemas.test.js` covering the home schema exposure, the happy paths (brightness normalization, hex color conversion, Kelvin→mired conversion with clamping on both ends), room/device targeting, and every error branch (missing values, missing target, unknown device, empty room, missing features, partial dispatch).
- New tests in `server/test/services/mcp/lib/formatValue.test.js` for the hex color formatting (including `null` last value).
<div><a href="https://cursor.com/agents/bc-b30f67e3-6144-40c3-95c2-70888b4cd88c"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-b30f67e3-6144-40c3-95c2-70888b4cd88c"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>
## Summary by CodeRabbit
* **New Features**
* Added light-control support for brightness, color, and color temperature.
* Added controls for setting light properties by device or room.
* Light colors are displayed in hexadecimal format.
* Light-control devices and capabilities now appear in available device information.
* **Bug Fixes**
* Improved handling and validation of brightness, color, and temperature values, including supported device limits.
* Clarified that on/off controls toggle lights, while property changes use dedicated light settings.
Ça partira dans la prochaine version de Gladys
C’est disponible dans Gladys Assistant 4.84 :
Bonsoir à tous !!
Je suis super heureux de sortir ce soir une version qui, je pense, va vraiment changer la vitesse d’évolution du projet.
Les intégrations externes arrivent enfin dans Gladys ! Elles vont permettre d’enrichir beaucoup plus rapidement la liste des appareils et services compatibles, tout en permettant à chacun de développer et partager ses propres intégrations.
Je vous explique tout dans cet article