Integración domótica gpsd, gratuita y de código abierto

Position, speed and fix of a GNSS receiver shared by gpsd (camper van, boat).
La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.
Shows in Gladys the position of a GPS / GNSS receiver shared by gpsd: a camper van, a boat, a cabin, a weather mast. gpsd reads the receiver (USB or serial) on its own machine and shares its reports on the network; this integration connects to it over TCP and reads them. It never touches USB nor a serial port, and never sends anything to the receiver.
This integration has never been tested with a real receiver: it was tested with gpsd 3.25 and
gpsfakereplaying an NMEA log. Feedback is welcome.
What you get
One device per gpsd address (Discovery tab), read only:
| Feature | Unit / values |
|---|---|
| Latitude | degrees, rounded (see Precision) |
| Longitude | degrees, rounded (see Precision) |
| Speed | km/h, to 0.1 |
| Altitude | metres above sea level, 3D fix only |
| Course | degrees from true north, above 2 km/h only |
| Fix mode | 1 no fix, 2 2D, 3 3D |
| Fix | text: no fix, 2D, 3D, 3D DGPS, 3D RTK fixed... |
| Horizontal error | metres, as estimated by gpsd |
| Satellites used | count |
| Satellites seen | count |
A value gpsd does not give stays unknown (never 0). Without a fix, only the fix mode and the fix text are published, never a position: Gladys keeps showing the last position, speed, altitude and course received, with their date (an integration cannot erase a value). Below 2 km/h the course is not updated. gpsd sends several reports per second, some without the course or the speed: a value missing from the newest one is taken from a report of the same fix at most 3 seconds old.
Before you start
-
gpsd must listen on the network: start it with
-G(on Debian, setGPSD_OPTIONS="-G"in/etc/default/gpsd). A socket-activated gpsd also needssudo systemctl edit gpsd.socketwith the lines below (the emptyListenStream=clears the local-only addresses first), thensudo systemctl restart gpsd.socket gpsd:[Socket]ListenStream=ListenStream=/run/gpsd.sockListenStream=0.0.0.0:2947Check with
gpspipe -w <address>from another machine. -
TCP port 2947 (or yours) must be reachable from Gladys. gpsd has no password: keep it on your local network, never open it to the internet.
Configuration
- gpsd address: name or IP address of the gpsd machine,
:portif not 2947 (IPv6 in brackets:[fd00::12]:2947). - Receiver (optional): only if gpsd reads several receivers, the path of
the one to follow as gpsd names it (
/dev/ttyACM0). Empty: the first one that reports; if gpsd deactivates it, the next one that reports is followed. The test button lists the other receivers seen; the status names them only when the configured receiver sends nothing. - Publication: gpsd reports about once a second; the integration keeps the newest report and publishes at most every 10 s, 30 s, 1 min (default), 5 min or 15 min, only the values that changed (an unchanged value is sent again once an hour). The first report is published at once, unless a publication left less than one interval ago.
- Position precision: about 1 m (5 decimals), 10 m (4, default), 100 m (3) or 1 km (2). The altitude follows (0.1 m, 1 m, 10 m, 100 m).
Privacy
A position is personal data. It is rounded before it reaches Gladys, never written in the logs, the status nor the answer of the test button. Latitude, longitude, altitude, course and the fix text keep no history by default (together they would draw your trips); speed, horizontal error, fix mode and satellites keep it. You may change this for each feature in Gladys.
Status and test button
The Configuration screen shows the state of the connection: connected with a fix, no fix yet, no active receiver, a configured receiver that sends nothing (with the receivers gpsd reports instead), no report for a minute, or the reason of a failure (refused, unknown name, unreachable, not gpsd, another protocol version, gpsd stopped answering). While connected, the status changes at most once every 10 seconds (a fix that comes and goes does not flood Gladys). A lost connection is tried again after 5 s, then 10, 20... up to 5 minutes. The Test the connection button tells the same state with the kind of fix (2D, 3D, DGPS...), the satellites and the pace; it never opens a new connection.
How it works
The integration reads the gpsd banner (VERSION, protocol 3), asks
?WATCH={"enable":true,"json":true}; (JSON reports only, never NMEA), and reads
the TPV (position, speed, fix), SKY (satellites) and DEVICE(S) (receivers)
objects. A connection silent for a minute is asked ?VERSION;; no answer within
10 s and it is closed and tried again. Lines are bounded (16 KiB) and so is the
flow (256 KiB/s).
Identity of the device
The device id is a digest of the gpsd address (host:port): another address
makes another device; a receiver moved to another USB port stays the same
device.
Unofficial integration, not affiliated with the GPSD project.
Parámetros de configuración
Estos son los parámetros que gpsd te pide en su pantalla de configuración en Gladys.
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| How it works | section | No | gpsd is the service that reads a GPS / GNSS receiver (USB or serial) and shares it on the network, on TCP port 2947. Gladys connects to it, reads its reports (gpsd JSON protocol) and turns them into one device (Discovery tab): latitude, longitude, speed, altitude, course, fix, horizontal error and satellites. Read only: nothing is ever sent to the receiver. gpsd must listen on the network (option -G) and be reachable from Gladys. A position is personal data: it is rounded as chosen below, never written in the logs; latitude, longitude, altitude and course are kept without history by default. Unofficial integration, not affiliated with the GPSD project. |
| gpsd address | string | Sí | Name or IP address of the machine running gpsd, followed by :port if gpsd does not listen on 2947. |
| Receiver (optional) | string | No | Only when gpsd reads several receivers: the path of the one to follow, as gpsd names it. Empty: the first receiver that reports. |
| Publication | select | Sí | gpsd reports about once a second; Gladys keeps the newest report and publishes at most at this pace, only the values that changed. |
| Position precision | select | Sí | Latitude and longitude are rounded before they reach Gladys (the altitude too). Coarser keeps your exact position private. |
Cómo instalar gpsd en Gladys
- En Gladys, abre Integraciones: gpsd aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
- Haz clic en Instalar. Gladys descarga la imagen Docker (
ghcr.io/lm1lc3n7/gladys-gpsd:0.1.1), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración). - Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
- También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-gpsd.
gpsd requiere Gladys >=5.1.0. El catálogo de Gladys se actualiza cada hora, así que una nueva versión está disponible como máximo una hora después de publicarse.
¿Todavía no usas Gladys? Es gratuito y de código abierto: sigue la guía de instalación para empezar.
Sobre las integraciones externas
gpsd es una integración externa: una integración comunitaria empaquetada como contenedor Docker y publicada en GitHub. Gladys la instala con un clic y la ejecuta en un entorno aislado del núcleo. La publica y mantiene LM1LC3N7, no el equipo principal de Gladys.
- Explorar todas las integraciones, nativas y de la comunidad
- Crear y publicar tu propia integración externa
- Código fuente en GitHub — fuente de esta documentación