Zum Hauptinhalt springen

gpsd Smart-Home-Integration, kostenlos und Open Source

gpsd-Integration für Gladys Assistant

Position, speed and fix of a GNSS receiver shared by gpsd (camper van, boat).

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

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 gpsfake replaying an NMEA log. Feedback is welcome.

What you get​

One device per gpsd address (Discovery tab), read only:

FeatureUnit / values
Latitudedegrees, rounded (see Precision)
Longitudedegrees, rounded (see Precision)
Speedkm/h, to 0.1
Altitudemetres above sea level, 3D fix only
Coursedegrees from true north, above 2 km/h only
Fix mode1 no fix, 2 2D, 3 3D
Fixtext: no fix, 2D, 3D, 3D DGPS, 3D RTK fixed...
Horizontal errormetres, as estimated by gpsd
Satellites usedcount
Satellites seencount

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, set GPSD_OPTIONS="-G" in /etc/default/gpsd). A socket-activated gpsd also needs sudo systemctl edit gpsd.socket with the lines below (the empty ListenStream= clears the local-only addresses first), then sudo systemctl restart gpsd.socket gpsd:

    [Socket]
    ListenStream=
    ListenStream=/run/gpsd.sock
    ListenStream=0.0.0.0:2947

    Check 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, :port if 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.

Konfigurationseinstellungen​

Diese Einstellungen fragt gpsd in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
How it workssectionNeingpsd 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 addressstringJaName or IP address of the machine running gpsd, followed by :port if gpsd does not listen on 2947.
Receiver (optional)stringNeinOnly when gpsd reads several receivers: the path of the one to follow, as gpsd names it. Empty: the first receiver that reports.
PublicationselectJagpsd reports about once a second; Gladys keeps the newest report and publishes at most at this pace, only the values that changed.
Position precisionselectJaLatitude and longitude are rounded before they reach Gladys (the altitude too). Coarser keeps your exact position private.

So installierst du gpsd in Gladys​

  1. Öffne in Gladys Integrationen: gpsd erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/lm1lc3n7/gladys-gpsd:0.1.1) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/LM1LC3N7/gladys-gpsd.

gpsd benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

gpsd ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von LM1LC3N7 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂