saml-dev / MMM-Traffic

This a module for the MagicMirror. It displays travel time between two locations, using the Mapbox directions API to factor in current traffic conditions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'legs' of undefined

arjun921 opened this issue · comments

0|mm  | TypeError: Cannot read property 'legs' of undefined
0|mm  |     at Request._callback (/home/pi/MagicMirror/modules/MMM-Traffic/node_helper.js:38:45)
0|mm  |     at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:185:22)
0|mm  |     at Request.emit (events.js:198:13)
0|mm  |     at Request.<anonymous> (/home/pi/MagicMirror/node_modules/request/request.js:1161:10)
0|mm  |     at Request.emit (events.js:198:13)
0|mm  |     at IncomingMessage.<anonymous> (/home/pi/MagicMirror/node_modules/request/request.js:1083:12)
0|mm  |     at Object.onceWrapper (events.js:286:20)
0|mm  |     at IncomingMessage.emit (events.js:203:15)
0|mm  |     at endReadableNT (_stream_readable.js:1145:12)
0|mm  |     at process._tickCallback (internal/process/next_tick.js:63:19)

Here's the config:

                {
                              module: 'MMM-Traffic',
                              position: 'top_right',
                              classes: 'dimmed medium', //optional, default is 'bright medium', only applies to commute info not route_name
                              config: {
                                              api_key: 'sdsa',
                                              origin: 'myHome',
                                              destination: 'WeWork',
                                              mode: 'driving',
                                              arrival_time: '0800', //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: 'pessimistic',
                                              interval: 120000 //2 minutes
                              }
                },

What am I doing wrong?

i have the same error.
Did you find the solution?

@dmrowe84 Sorry bud, I don't remember anymore 😓
It's been a while but probably switched to another module if this didn't work.

@arjun921 @dmrowe84 Acknowledged. I am going to dig back into this project this weekend. Sorry for the delayed response. I will post here after the update.

@arjun921 I have updated the module as well as the README. Now if there are errors it will show you on the module itself instead of just getting stuck on Loading...

Let me know if you still have issues

Going to close this since it's so old and it's hopefully resolved with the latest updates. Be sure to update and give it another shot, if you're still having problems please open a new issue with a description of what you're seeing. Thanks!