đźš— Mapbox traffic integration

:automobile: New integration: Mapbox Traffic — your travel times in Gladys

Hello,

I present to you Mapbox Traffic, a new external integration for Gladys that tracks the duration of your usual trips (home → work, school, gym…) with real-time traffic, thanks to the Mapbox Directions API (This integration allows me to replace a workaround I had set up with a Gladys scene (API call + virtual MQTT device)).

The idea: to know at a glance if you need to leave earlier this morning, and to be automatically notified in case of a traffic jam.

:sparkles: What it brings

For each configured trip (up to 3), a Gladys device with:

  • :stopwatch: the travel time with current traffic;
  • :bar_chart: the usual duration at this time of the week, and the delay compared to it;
  • :vertical_traffic_light: the traffic level: smooth, slow, congested, heavy traffic jam;
  • :motorway: the distance and the routes taken (« A86, A1 »).

Durations are recorded: you get the graph of your travel time for the day or the week directly.

And also:

  • :desktop_computer: a dashboard widget « Travel time »: duration, delay, « current vs usual » curve and Refresh button;
  • :clapper_board: 4 scene triggers: traffic jam, end of traffic jam, abnormally long duration, return to normal;
  • :high_voltage: 1 scene action: « Get the duration of a trip ».

:light_bulb: Some scene ideas

  • :mobile_phone: Traffic jam alert: « Traffic jam on the Work trip » → message « Traffic jam to work: 40 min (+15 min) ».
  • :sun: Morning briefing: at 7 a.m. on weekdays → « Get the trip duration » → message with the summary.
  • :bell: Personal threshold: it’s a standard Gladys device, so the native trigger also works (« if Travel time > 45 min »).

:hammer_and_wrench: Installation

  1. Create a free account on Mapbox and copy your public token (pk.…).
  2. Install Mapbox Traffic from the Gladys integrations catalog.
  3. Paste the token, then fill in your trips. The departure and destination accept an address or coordinates. Leave the departure blank to start from the position of your home.
  4. Click on Test Mapbox, then add your trips from the Discovery tab.

:money_bag: Free for domestic use: the free Mapbox plan includes 100,000 requests per month. For example, 3 trips updated every 5 minutes for 5 hours per working day consumes approximately 4,000 requests. You can limit updates to certain days and times to save your quota.

:warning: Requires Gladys 5.1.0 or higher, for scene triggers and the widget.

:link: Links

This is a first version: your feedback, ideas, and bugs are welcome, here or as an issue on GitHub :folded_hands:

Have a great weekend!

Oh great!
I was still thinking about it this morning because on Jeedom there was WazeIntime that did that :ok_hand:

Thanks for this integration :slight_smile:

For my Home → Work route, I can take several paths
Would it be possible to choose this path?
By default, it seems to take the fastest route

Thanks

Thanks for the feedback :slight_smile:

Indeed, Mapbox always takes the fastest route. It is now possible to choose your route with the version 1.1.0 of the integration, which has just been released.

Each route has a new field « Via » in the Configuration tab. You can specify one or more waypoints, in order, separated by ; (up to 3). This can be:

  • an address or a city (« Pont de Normandie », « Rouen »);
  • coordinates « latitude, longitude » copied from Google Maps (right-click on the road).

Example: Pont de Normandie; 49.4431, 0.3601

The route will then go through these points instead of taking the fastest one. The durations, the graph, and the traffic alerts are based on your route.

A few tips:

  • Choose points located on the road you are taking, not next to it. Otherwise, Mapbox makes a detour to reach them. The most reliable way is to click directly on the road in Google Maps and copy the coordinates.
  • A single well-placed point is often enough to force the correct route.
  • Click on Test Mapbox to check: the message displays the full route (departure → waypoints → arrival) and the duration obtained.

This does not consume any additional Mapbox requests

Let me know if it’s okay for you :wink:

That’s fine with me :slight_smile:

Thanks

Hello,

Would it be possible to have a widget like this one on Mapbox, please? :slight_smile:

I found it on the « HERE Travel Time Â» integration, thanks @Will_71 :slight_smile:

Hello, I’ve released a new version, let me know if it suits you:

It’s perfect :slight_smile: Thank you very much