Skip to content
MagicMirror module that shows the best routes from A to B
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENCE Add licence May 19, 2018
MMM-google-route.css Initial module structure May 19, 2018
MMM-google-route.js Support route refresh on configured notifications Apr 26, 2019 Support route refresh on configured notifications Apr 26, 2019
map-styles.js Set dark map style May 19, 2018
screenshot.png Add readme May 19, 2018


Alt text

A module for the MagicMirror² that displays the two best routes from an origin to a destination, using Google Directions API.

Using the module

To use this module, clone this repo to your MagicMirror/modules/ directory.

git clone

And add the following configuration block to the modules array in the config/config.js file:

var config = {
    modules: [

            module: 'MMM-google-route',
            position: 'top_left',
            config: {
                key: '<YOUR_KEY>',
                    origin: '<ROUTE START>',
                    destination: '<ROUTE FINISH>'


Configuration options

Option Description
key Required Google api key. See below for help.
Type: string
directionsRequest Required The directions to show on the map.
Type: google.maps.DirectionsRequest interface
title Optional title to show above the map.
Type: string
height Height of the map.
Type: string (pixels)
Default value: 300px
width Width of the map.
Type: string (pixels)
Default value: 300px
refreshPeriod Period between API requests. Set to 0 to disable periodic refresh.
Type: integer (minutes)
Default value: 1
showAge Show how long ago the routes were updated.
Type: boolean
Default value: true
fontSize Size of the title and routes font. Use a percentage to specify size relative to default.
HTML DOM Style fontSize property
Type: string
Default value: 100%
mapOptions Map visualization options.
Type: google.maps.MapOptions interface
listen Refresh the route when receiving these notifications and use the location contained in the notification as destination (if available).
Specify the ID of the notifications to listen for.
Type: string[]
Default value: []

Google API Key

Obtain an api key at Google Developer's page.

Google directions service errors

If "Google directions service status:" error message appears, it means that the request to the Google directions service failed for some reason.

The list of error codes and their meanings can be found here.

Importance of correct date/time settings

If "Google directions service status: INVALID_REQUEST" error message appears, it could be due to an invalid setting of the current date and time on the device that is displaying the mirror interface.

This is due to the departureTime field of the drivingOptions field passed to the directions API being set to one minute from the current time, and google service checking that this timestamp is in the future.

Using MMM-ModuleScheduler to configure the route refresh interval

You can use the MMM-ModuleScheduler module to trigger route updates using a certain schedule.
This may be useful for example to refresh the route more frequently in the morning and less frequently during the rest of the day, reducing the risk of exceeding the query limit set by google.

Just set "MMM-google-route/refresh" as the notification id in the notification_schedule configuration parameter of the module, e.g.

        module: 'MMM-ModuleScheduler',
        config: {
            notification_schedule: [
                // Refresh the route every minute from 7:00 AM to 8:00 AM, monday to friday
                { notification: 'MMM-google-route/refresh', schedule: '* 7 * * 1-5' }

Notifications supported as destination providers


The first valid location field of the events contained in the notification payload will be used as destination.

You can’t perform that action at this time.