Skip to main content

WSDOT (unofficial) smart home integration, free and open source

WSDOT (unofficial) integration for Gladys Assistant

Unofficial. Washington State highway alerts, travel times, passes and ferries.

Unofficial integration: highway alerts, travel times, mountain pass reports and Washington State Ferries drive-up space in Washington State (United States), read from the official WSDOT Traveler Information API.

Data: Washington State Department of Transportation (WSDOT), https://wsdot.wa.gov/traffic/api/. This integration is not an official source and is not endorsed by WSDOT: check WSDOT before you travel.

This integration was written from the official documentation of the API and has never been tested with a real access code (none was available while it was written): its tests use a fake WSDOT server that answers like the documented services. The refusals of a missing or unknown code were checked against the real API.

Access code​

The API asks for a free access code: enter your email address on https://wsdot.wa.gov/traffic/api/ and WSDOT emails you the code. Paste it in the Access code field. It is kept by Gladys in its database, never shown again, and sent only to WSDOT (wsdot.wa.gov), in the address of each request as the API requires. It never appears in the logs, the status or the files of the integration.

What you can follow​

DeviceWhatValues
Alert zone (up to 3)A circle around a point (1 to 100 km) in Washington StateAlerts in effect, high priority alerts, summary
Travel time route (up to 6)A WSDOT travel time route (id or name)Current and average travel time (minutes)
Mountain pass (up to 4)Snoqualmie, Stevens, White Pass... (id or name)Temperature (°F), conditions and restrictions (text)
Ferry terminal (up to 4)A Washington State Ferries departure terminalDrive-up spaces of the next sailing, next sailings text

Routes, passes and terminals are typed as a WSDOT id or a name as WSDOT writes it, separated by commas; a part of a name works when only one WSDOT name holds it ("Snoqualmie", "Stevens"). Names are known after the first read: the status lists what was not found, or what matches several names. An id is followed even before the first read.

An alert counts in a zone when its start or end point is inside the circle and it is in effect at the time of the WSDOT answer: listed by WSDOT (the service sends the current alerts), not marked closed, and started. The end time WSDOT gives is an estimate: an alert still listed past it still counts. "High priority" means a WSDOT priority of Highest or High (case ignored).

Reading pace​

  • One request per kind of data for the whole state (grouped reads): adding a zone, a route or a terminal adds no request. Only the kinds the configuration uses are read.
  • Alerts and travel times at the interval (5 to 60 minutes, 10 by default); ferries at the interval but every 15 minutes at least (their sailing space changes every few seconds); mountain passes every 30 minutes at the most often (their reports change a few times a day). The interval runs from the start of one round of reads to the start of the next.
  • One request at a time, 2 seconds apart. A restart, a reconnection, a saved configuration, Discovery and the test button do not read a kind of data sooner than its interval (the time of the last attempt is kept in /data); a zone added or moved is evaluated against the alerts already read. A kind of data the configuration did not use before is read at once. A configuration saved while a request is out keeps its answer, and the kinds not read yet in that round are read at once.
  • A 429 (too many requests), a server error or another unexpected answer pauses that kind of data only, 2 minutes first (10 for a 429), doubled up to 6 hours, or longer when WSDOT asks for it (Retry-After, up to 6 hours); the pause is kept across a restart. The other kinds go on.

Values that are not published​

An unknown value stays unknown, it is not published as 0:

  • a travel time of 0 minutes (WSDOT has no data on the route) or a missing one;
  • a pass temperature WSDOT leaves empty;
  • the drive-up spaces of a sailing when WSF does not show them, when the sailing serves several destinations (the text lists each one), or when no sailing is listed.

Stale data is not published as new: a travel time older than 2 hours, or a pass report older than 24 hours (times of WSDOT, judged against the time of its answer), is not sent; a travel time or a pass report is sent once per WSDOT update. A read that fails publishes nothing: Gladys keeps the last values and the status says since when.

The ferry values are those of the time of the last read (15 minutes at most): they are not sent again on a reconnection or a device created, and when no sailing is listed Gladys keeps the last number of spaces next to the text "No sailing listed".

A refused access code​

When every kind of data the configuration uses refuses the code (HTTP 401, or the 400 answers WSDOT gives to an unknown code), none having accepted it since, the integration stops reading: no automatic retry. It reads again when you change the code, or when you press Show the last read (one try, 5 minutes at least after the last attempt). A new code is tried at once; after a restart it is told from the refused one by two 8-bit fingerprints, which miss it once in 65536 (press the button then). A code refused by one service while another accepts it is not taken as refused: only that service is paused, until the end of the pause or a new code.

Scene trigger​

New WSDOT alert in a zone: an alert in effect appears in a zone for the first time, updated or started within the last 2 hours. The first read of a zone (or of a moved zone) only learns what is there. Without a believable time in the WSDOT answer, no trigger fires. Filters: zone, priority. Variables: alert id, category, high priority, road, headline (English), distance from the zone center. At most 10 per zone and per read.

Status and button​

The status tells, per kind of data, the time of the last read, a pause and its end, the counts of each zone, the entries not found, and the time of the next read. Show the last read shows the same; it reads only to try a refused code again.

Privacy​

The zones (which may be your home) stay in the configuration and in Gladys: WSDOT receives no position, the alerts of the whole state are filtered here. /data keeps only times, pauses, a salted fingerprint of each zone, the ids of the alerts already seen, the names WSDOT gives to its routes, passes and terminals, and two 8-bit salted fingerprints of a refused code (enough to notice a new code, useless to guess one).

Limits​

  • Texts from WSDOT (headlines, conditions, names) are in English; device names and labels follow the language of the configuration.
  • The WSDOT and WSF APIs may change their format: an answer that cannot be read publishes nothing and the status says so.

Configuration settings​

These are the settings WSDOT (unofficial) asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
WSDOT traveler informationsectionNoHighway alerts, travel times, mountain pass reports and ferry drive-up space published by the Washington State Department of Transportation (WSDOT), read from its official Traveler Information API with a free access code. One request per kind of data for the whole state, at the interval below. Data: WSDOT. Check WSDOT before you travel: this integration is not an official source.
Access codesecretYesThe code WSDOT emails you after registering on its Traveler API page (link above). Kept by Gladys in its database, never shown again, sent only to WSDOT (wsdot.wa.gov), in the address of each request as the API requires.
Language of the device textsselectNoLanguage of the device names and texts (WSDOT texts stay in English).
Read interval (minutes)numberNoFrom 5 to 60 minutes. Mountain passes are read every 30 minutes at most often (their reports change a few times a day).
Alert zone 1 (optional)sectionNoA circle around a point: the highway alerts in effect inside it are counted. Leave the latitude and longitude empty to turn it off.
NamestringNoName of the device in Gladys (60 characters at most).
LatitudenumberNoCenter of the zone, in Washington State (decimal degrees).
LongitudenumberNoCenter of the zone (decimal degrees, negative: west).
Radius (km)numberNoFrom 1 to 100 km.
Alert zone 2 (optional)sectionNoA circle around a point: the highway alerts in effect inside it are counted. Leave the latitude and longitude empty to turn it off.
NamestringNoName of the device in Gladys (60 characters at most).
LatitudenumberNoCenter of the zone, in Washington State (decimal degrees).
LongitudenumberNoCenter of the zone (decimal degrees, negative: west).
Radius (km)numberNoFrom 1 to 100 km.
Alert zone 3 (optional)sectionNoA circle around a point: the highway alerts in effect inside it are counted. Leave the latitude and longitude empty to turn it off.
NamestringNoName of the device in Gladys (60 characters at most).
LatitudenumberNoCenter of the zone, in Washington State (decimal degrees).
LongitudenumberNoCenter of the zone (decimal degrees, negative: west).
Radius (km)numberNoFrom 1 to 100 km.
Travel times, passes and ferries (optional)sectionNoEach entry is a WSDOT id or a name as WSDOT writes it, separated by commas; a part of a name works when only one WSDOT name holds it. One device each. Names are known after the first read; the status lists what was not found.
Travel time routesstringNoUp to 6 routes, as named by WSDOT (TravelTimeID or name).
Mountain passesstringNoUp to 4 passes (MountainPassId or name).
Ferry terminalsstringNoUp to 4 Washington State Ferries departure terminals (TerminalID or name): the drive-up space of their next sailings.

How to install WSDOT (unofficial) in Gladys​

  1. In Gladys, open Integrations: WSDOT (unofficial) appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/lm1lc3n7/gladys-wsdot:0.1.2), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/LM1LC3N7/gladys-wsdot.

WSDOT (unofficial) requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

WSDOT (unofficial) is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by LM1LC3N7, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂