Description
Actuellement, l’intégration Google Home de Gladys permet principalement d’exposer les appareils de type :
Lumière
Interrupteur / prise
Volet
Rideau
Avec notamment les fonctionnalités On/Off, luminosité, couleur et position.
Il serait intéressant d’étendre cette intégration afin que davantage de types d’appareils et de fonctionnalités Gladys puissent être exposés dans Google Home.
Exemples d’appareils
Capteurs
Pouvoir faire remonter les capteurs compatibles, notamment :
Température
Humidité
Éventuellement d’autres types de mesures supportés par Google Home
Cela permettrait par exemple de retrouver dans Google Home les températures des différentes pièces mesurées par Gladys.
Télévisions
Ajouter le support des télévisions avec, selon les fonctionnalités disponibles dans Gladys et celles supportées par Google Home :
On / Off
Volume
Mute
Sélection de la source
Contrôles multimédias
Sélection d’une application
Cela pourrait notamment être utilisé par les intégrations TV existantes ou futures dans Gladys.
Caméras
Étudier la possibilité d’exposer les caméras Gladys à Google Home afin de pouvoir consulter leur flux depuis les appareils compatibles (Nest Hub, Google TV, application Google Home, etc.).
Cela nécessiterait notamment de vérifier la compatibilité entre les flux disponibles dans Gladys et le trait CameraStream de Google Home.
Objectif
L’idée serait d’enrichir progressivement le mapping entre les catégories/types de fonctionnalités Gladys et les device types / traits proposés par Google Home.
L’architecture actuelle de l’intégration Google Home semble déjà permettre d’ajouter de nouveaux deviceTypes et traits indépendamment, ce qui permettrait éventuellement de réaliser cette évolution progressivement, type d’appareil par type d’appareil.
Salut tout le monde !
Ce sujet est désormais en cours de développement .
Une PR a été ouverte pour exposer les capteurs de température et d’humidité dans Google Home :
master ← claude/google-home-sensors-tv
ouvert 02:39AM - 18 Aug 26 UTC
Implements feature request: https://community.gladysassistant.com/t/google-home-… ajouter-les-tv-capteur-de-temperature/10638
### Description
The Google Home (Google Actions) integration only exposed lights, switches/plugs, shutters and curtains. The forum request asks to progressively extend the mapping between Gladys device feature categories and Google Home device types / traits, starting with sensors (temperature, humidity), then TVs, then cameras.
**This PR covers the sensor part: temperature and humidity.** Room temperatures and humidity levels measured by Gladys now show up in the Google Home app.
What is added, following the existing `deviceTypes/` + `traits/` structure of the integration:
- `traits/googleActions.temperatureControl.trait.js` — `action.devices.traits.TemperatureControl` for the `temperature-sensor` category (`decimal` and `integer` feature types).
- Attributes: `queryOnlyTemperatureControl: true` (Gladys only exposes sensors here, they never receive a setpoint), `temperatureUnitForUX` (`F` when the feature is in Fahrenheit, `C` otherwise) and `temperatureRange` built from the feature `min`/`max` when both are set.
- State: `temperatureAmbientCelsius`. Google Home only works in Celsius, so Fahrenheit and Kelvin features are converted (`fahrenheitToCelsius` from `server/utils/units.js`, `- 273.15` for Kelvin), like the HomeKit service already does. Values are rounded to one decimal to avoid sending the floating point noise of the conversions, and a sensor that has no value yet reports `null` instead of a converted `0`.
- `traits/googleActions.humiditySetting.trait.js` — `action.devices.traits.HumiditySetting` for the `humidity-sensor` category.
- Attributes: `queryOnlyHumiditySetting: true`. State: `humidityAmbientPercent`, rounded to an integer as Google requires.
- `deviceTypes/googleActions.temperatureSensor.type.js` and `deviceTypes/googleActions.humiditySensor.type.js` — both map to `action.devices.types.SENSOR`.
- Registration in `deviceTypes/index.js` and `traits/index.js`. The two sensor types are registered **last** so that a device mixing an actionable category with a sensor category (a light that also measures the temperature, for example) keeps its actionable Google type and simply gains the sensor trait.
Both traits are read-only: they are reported in SYNC and QUERY and declare no EXECUTE command (`commands: {}`), so the existing EXECUTE code path is unchanged.
No frontend or data-model change, no new translation key.
### Left for follow-up PRs
The topic explicitly suggests doing this progressively, device type by device type, so this PR deliberately stops at sensors:
- **Televisions**: `DEVICE_FEATURE_CATEGORIES.TELEVISION` exists in `server/utils/constants.js`, but no integration currently produces those features (only the Broadlink IR migration references them), and the types are mostly one-shot IR buttons (`volume-up`, `channel-up`, `source`…). Google Home's `Volume`, `InputSelector` and `AppSelector` traits need an absolute volume, a mute state and a *named* list of inputs/apps, which Gladys does not model today. Doing it properly means changing the device model first, which does not belong in this PR.
- **Cameras**: the requester himself flags the `CameraStream` trait as "to be studied" (stream format compatibility), and it cannot be validated without real hardware.
- **Other measurements**: CO2, PM2.5, PM10 and VOC could later be mapped onto Google's `SensorState` trait, which needs its own descriptive/numeric capability design.
## Forum
Forum: https://community.gladysassistant.com/t/google-home-ajouter-les-tv-capteur-de-temperature/10638
### Checklist
- [x] Tests pass: `cd server && npm run coverage` (Codecov requires 100% coverage on changed lines) and Cypress (`npm run cypress:run`) if the UI changed
- [x] Linter and prettier pass on both front and server (`npm run eslint`, `npm run prettier`)
- [x] No undocumented breaking change
Notes on the checks that were run:
- Two new test files mirror the existing ones in `server/test/services/google-actions/lib/smarthome/devices_and_traits/`, covering SYNC and QUERY for Celsius, Fahrenheit and Kelvin features, `decimal` and `integer` types, a device with and without `min`/`max`, a device mixing a light and a temperature sensor, a combined temperature + humidity sensor, and sensors with no value yet. Coverage of the whole `services/google-actions` folder is 100% statements / lines and 100% branches on every new file.
- `npm run prettier-check` and `npm run eslint` pass on the server with no error.
- The full server suite was run; the only failures are pre-existing environment ones in this sandbox (`gateway.backup` / restore tests need the `sqlite3` CLI binary and network access), untouched by this change.
- The frontend is not modified, so no front check was needed. Cypress was not run (binary not installed in this environment) and no UI route or component changed.
This pull request was created by an automated Claude Code run.
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
_Generated by [Claude Code](https://claude.ai/code/session_01YXRz5JiaM9N42djviseBRu)_
N’hésitez pas à suivre la PR, à tester (optionnel, surtout pour les petites demandes) et à faire vos retours ici si besoin.