WolfVic
25. Oktober 2026 um 21:51
1
Hallo,
Diese Anfrage bezieht sich auf dieses geschlossene Issue, um es hier zu besprechen, aber ich habe keinen Beitrag dazu gesehen:
ouvert 11:20PM - 17 Oct 26 UTC
fermé 08:42AM - 23 Oct 26 UTC
claude:blocked
## Problem
An external integration cannot publish the position of a Gladys user… today (checked on core `0027571e` and `@gladysassistant/integration-sdk` 0.15.0):
- the SDK has no method for it: `getHouses()` reads the houses only (behind `location: true`), nothing about users or their location;
- the host API (`/api/integration/v1/*` in `server/api/routes.js`) has no user or location route;
- `post /api/v1/user/:user_selector/location` exists, but it takes a user session (`authenticated: true`), not the token of an integration;
- OwnTracks reaches `location.create` only through the Gladys Plus gateway (`location.handleNewGatewayOwntracksLocation.js`).
So location trackers integrated as external integrations can only publish latitude/longitude as plain device features: the user map, the areas (`user.new-location`) and the scenes based on them do not react.
The first case is [gladys-phonetrack](https://github.com/LM1LC3N7/gladys-phonetrack) (PhoneTrack, the Nextcloud app: self-hosted phone tracking), but the same need applies to any tracker (Traccar, Invoxia, car integrations with a GPS position…).
## Proposal
A minimal host route, with an explicit manifest declaration and a per-user consent:
1. `server/api/routes.js`: `'post /api/integration/v1/user/:user_selector/location'`, with `authenticated: false, externalIntegrationAuth: true`, controller `integrationHostController.publishUserLocation`.
2. `server/api/controllers/integrationHost.controller.js`: body `{ latitude, longitude, accuracy?, altitude?, created_at? }` (validated: numbers and ranges), calling a new `server/lib/external-integration/externalIntegration.publishUserLocation.js` that:
- checks a manifest declaration `user_location: true` (shown on the install screen, 403 otherwise, like `location` for the houses);
- checks that this user chose this integration as a source of their position (consent per user, for example a `users` dynamic source in `DYNAMIC_SOURCES` of `server/lib/external-integration/constants.js`, so a device can be linked to its user in the integration's configuration);
- then calls `gladys.location.create(userSelector, location)`, which already updates the user, emits `user.new-location` for the areas and the websocket event of the map.
3. `validateManifest.js`, and `docs/specs/external-integrations/contracts/host-api-endpoints.md` and `manifest.md`: the new field and route; tests next to the house ones.
4. SDK: `gladys.publishUserLocation(userSelector, { latitude, longitude, accuracy, altitude })`, and the `users` source in the fake Gladys used by integration tests.
Nothing changes for existing integrations: without `user_location: true` in the manifest, the route answers 403.
Happy to open the PR if the approach suits you.
Wäre es möglich, die Position eines Benutzers über das Protokoll der externen Integrationen zu aktualisieren? Das würde bedeuten, einen Teil der Integration mit owntracker zu verallgemeinern, nehme ich an. (Ich entdecke Gladys nach einer Pause von fast 10 Jahren wieder, wenn ich meinem Forumeintrag glauben darf)
Eine weitere interessante Ergänzung wäre die Möglichkeit, die Position eines Geräts über das Protokoll zu aktualisieren. Dies wäre besonders nützlich für Autos (z. B.: Intégration domotique MySkoda, gratuite et open source | Gladys Assistant , das die Position derzeit als Text speichert).