MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MM & Google Maps Traffic

    Scheduled Pinned Locked Moved Troubleshooting
    16 Posts 4 Posters 18.1k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      Mirrorolentia @Mirrorolentia
      last edited by Mirrorolentia

      Please install the MMM-Traffic module and replace the MMM-Traffic.js with the above code.
      Below is a sample entry in config.js

      {
                  module: 'MMM-Traffic',
                  position: 'top_left',
                  classes: 'dimmed medium', //optional, default is 'bright medium', only applies to commute info not route_name
                  config: {
                      api_key: '', // Your Google Maps API_KEY needs to go here
                      mode: 'driving',
                      origin: '',
                      destination: '',
                      mon_destination: '',
                      arrival_time: '', //optional, but needs to be in 24 hour time if used.
                      route_name: 'Home to Work',
                      changeColor: true,
                      showGreen: false,
                      limitYellow: 5, //Greater than 5% of journey time due to traffic
                      limitRed: 20, //Greater than 20% of journey time due to traffic
                      traffic_model: 'best_guess',
                      interval: 60000, //2 minutes
                      showWeekend: true,
                      allTime: true,
                      width: '300px',
                      height: '300px'
                  }
              },
      
      1 Reply Last reply Reply Quote 1
      • M Offline
        Mirrorolentia
        last edited by

        There are two catches which I will try to correct:

        1. The Google Maps have their own lifecycle which I could not align with MM module’s. So you may not see the map in the first instance but it will get uploaded within the next interval (as configured in config.interval).
        2. The Maps div element keeps getting refreshed after every interval which is a bit irritating :(
        D 1 Reply Last reply Reply Quote 0
        • strawberry 3.141S Offline
          strawberry 3.141 Project Sponsor Module Developer @birdy
          last edited by

          @birdy you are missing quotes around the drivin mode, should be mode: 'driving'

          Please create a github issue if you need help, so I can keep track

          1 Reply Last reply Reply Quote 0
          • D Offline
            devtech8 @Mirrorolentia
            last edited by

            @Mirrorolentia - I was thinking of trying this too, but looks like you have made some progress. I hope to dig into what you have later this week. I had seen some further customization I would like to add when time allows. Thanks for the work on this!

            M 1 Reply Last reply Reply Quote 0
            • M Offline
              Mirrorolentia @devtech8
              last edited by

              @devtech8
              Sure that would be great! Thanks!

              1 Reply Last reply Reply Quote 0
              • B Offline
                birdy
                last edited by

                @Mirrorolentia - wow, thx!! I will test it later :) can’t await

                1 Reply Last reply Reply Quote 0
                • B Offline
                  birdy
                  last edited by

                  so, as a complete noobie, I just pasted the code (adding Google Api key) in both files.

                  I can see, there is a gap in the corner (I hope for the map) and if I get you correctly, the map will load “soon”(?).

                  Thank you one more time and will keep u posted.

                  Cheers
                  Birdy

                  M 1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mirrorolentia @birdy
                    last edited by

                    @birdy
                    Yes that is correct. You will need to copy the lines from /global module**/ all the way till end…somehow the comments didn’t embed the code correctly

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      birdy
                      last edited by

                      somehow it’s not working:
                      0_1504081238365_InkedIMG_1205_LI.jpg

                      M 1 Reply Last reply Reply Quote 0
                      • M Offline
                        Mirrorolentia @birdy
                        last edited by

                        @birdy
                        Seems like the MM system didn’t initialize the module itself :(
                        Are you seeing any errors on the console from where you run “node serveronly” or on the chromium browser i.e from More Tools–> Developer Tools–>Console.

                        1 Reply Last reply Reply Quote 0
                        • B Offline
                          birdy
                          last edited by

                          you mean like this:

                          Connecting socket for: MMM-Traffic
                          MMM-Traffic helper started ...
                          Sockets connected & modules started ...
                          
                          Ready to go! Please point your browser to: http://localhost:8080
                          Whoops! There was an uncaught exception...
                          { Error: listen EADDRINUSE :::8080
                              at Object.exports._errnoException (util.js:1020:11)
                              at exports._exceptionWithHostPort (util.js:1043:20)
                              at Server._listen2 (net.js:1258:14)
                              at listen (net.js:1294:10)
                              at net.js:1404:9
                              at _combinedTickCallback (internal/process/next_tick.js:83:11)
                              at process._tickCallback (internal/process/next_tick.js:104:9)
                              at Module.runMain (module.js:606:11)
                              at run (bootstrap_node.js:389:7)
                              at startup (bootstrap_node.js:149:9)
                            code: 'EADDRINUSE',
                            errno: 'EADDRINUSE',
                            syscall: 'listen',
                            address: '::',
                            port: 8080 }
                          MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                          If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                          
                          
                          M 1 Reply Last reply Reply Quote 0
                          • M Offline
                            Mirrorolentia @birdy
                            last edited by Mirrorolentia

                            @birdy
                            Sorry for the delayed response. Got caught with stuff :(
                            By any chance do you have some other server running in parallel which is also listening on 8080 and using any available IPv6 address. Ideally you should have only “node” running with the specified port
                            You can check this with netstat.

                            netstat  -nalp | grep 8080
                            
                            tcp6       0      0   ::: 8080                 ::: *                    LISTEN      2350/node
                            tcp6       0      0 ::1:43558               ::1:8080                ESTABLISHED 2103/libpepflashpla
                            tcp6       0      0 ::1:8080                ::1:43558               ESTABLISHED 2350/node
                            
                            

                            You can try killing that service (In the last column i.e 2350/node, 2350 represents PID. You can use "kill -9 ") and then probably restart the Magic Mirror.
                            Also this may not be related to the actual problem.
                            Please see if you can post your config.js.

                            1 Reply Last reply Reply Quote 0
                            • B Offline
                              birdy
                              last edited by

                              @Mirrorolentia
                              thanks for helping me and sorry for late reply.

                              Here comes the config:

                              /* Magic Mirror Config Sample
                               *
                               * By Michael Teeuw http://michaelteeuw.nl
                               * MIT Licensed.
                               *
                               * For more information how you can configurate this file
                               * See https://github.com/MichMich/MagicMirror#configuration
                               * 
                               */
                              
                              var config = {
                              	port: 8080,
                              	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
                              	                                                       // or add a specific IPv4 of 192.168.1.5 :
                              	                                                       // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
                              	                                                       // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
                              	                                                       // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
                              
                              	language: "en",
                              	timeFormat: 24,
                              	units: "metric",
                              
                              	modules: [
                              		{
                              			module: "alert",
                              		},
                              		{
                              			module: "updatenotification",
                              			position: "top_bar"
                              		},
                              		{
                              			module: "clock",
                              			position: "top_left"
                              		},
                              		{
                              			module: "calendar",
                              			header: "AWISTA & Feiertage NRW",
                              			position: "top_left",
                              			config: {
                              				calendars: [
                              					{
                              						symbol: "calendar-check-o ",
                              						url: "https://calendar.google.com/calendar/ical/**********/public/basic.ics"
                              					}
                              				]
                              			}
                              		},
                              		{
                              			module: "compliments",
                              			position: "lower_third"
                              		},
                              		{
                              			module: "currentweather",
                              			position: "top_right",
                              			config: {
                              				location: "Dusseldorf",
                              				locationID: "2934246",  //ID from http://www.openweathermap.org/help/city_list.txt
                              				appid: "************"
                              			}
                              		},
                              		{
                              			module: "weatherforecast",
                              			position: "top_right",
                              			header: "Weather Forecast",
                              			config: {
                              				location: "Dusseldorf",
                              				locationID: "2934246",  //ID from http://www.openweathermap.org/help/city_list.txt
                              				appid: "***********"
                              			}
                              		},
                              		{
                                  			module: 'MMM-Vrr',
                                  			position: "bottom_left",
                                  			config: {
                                      			city: 'Düsseldorf',
                                      			station: '***********',
                                      			numberOfResults: 6,
                                      			displayTimeOption: 'time+countdown'
                              		        }
                              		},
                              		{
                              		    module: "MMM-Fuel",
                              		    position: "bottom_right",
                              		    config: {
                              		        api_key: "************",
                              		        lat: *********,
                              		        lng: ************,
                              		        types: ["diesel"],
                              			radius: 1.4,
                              			max: 2,
                              			rotate: false,
                              		    	}
                              		},
                              		{
                              		module: 'MMM-Traffic',
                              		position: 'bottom_right',
                              		classes: 'dimmed medium', //optional, default is 'bright medium', only applies to commute info not route_name
                              		config: {
                              			api_key: '*********',
                              			mode: 'driving',
                              			origin: '******+Düsseldorf,+Deutschland',
                              			destination: '**********+Essen,+Deutschland',
                              			route_name: 'Home to Work',
                              			changeColor: true,
                              			showGreen: false,
                              			limitYellow: 5, //Greater than 5% of journey time due to traffic
                              			limitRed: 20, //Greater than 20% of journey time due to traffic
                              			traffic_model: 'best_guess',
                              			departure_time: 'now',
                              			interval: 60000,
                              			showWeekend: false,
                              			allTime: true,
                              	                width: '300px',
                              	                height: '300px'
                              			}		
                              		},
                              	]
                              };
                              
                              /*************** DO NOT EDIT THE LINE BELOW ***************/
                              if (typeof module !== "undefined") {module.exports = config;}
                              
                              

                              and here is netstat:

                              pi@raspberrypi:~ $ netstat -nalp | grep 8080
                              (Es konnten nicht alle Prozesse identifiziert werden; Informationen über
                              nicht-eigene Processe werden nicht angezeigt; Root kann sie anzeigen.)
                              tcp6       0      0 :::8080                 :::*                    LISTEN      1119/electron.js
                              tcp6       0      0 ::1:51608               ::1:8080                VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51610               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:51606               ::1:8080                VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:51600               ::1:8080                VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:51610               ::1:8080                VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:51604               ::1:8080                VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51608               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51598               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51600               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:51602               ::1:8080                VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51606               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51604               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:8080                ::1:51602               VERBUNDEN   1119/electron.js
                              tcp6       0      0 ::1:51598               ::1:8080                VERBUNDEN   1119/electron.js
                              pi@raspberrypi:~ $ 
                              
                              
                              1 Reply Last reply Reply Quote 0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • 1 / 1
                              • First post
                                Last post
                              Enjoying MagicMirror? Please consider a donation!
                              MagicMirror created by Michael Teeuw.
                              Forum managed by Sam, technical setup by Karsten.
                              This forum is using NodeBB as its core | Contributors
                              Contact | Privacy Policy