nwootton / MMM-UKLiveBusStopInfo

Magic Mirror Module for UK bus information. Returns real-time info about a SPECIFIC bus stop
MIT License
17 stars 12 forks source link

Stuck on loading-Error "Cannot read property 'length' of undefined #5

Closed davidnesbitt7 closed 7 years ago

davidnesbitt7 commented 7 years ago

Hi,

I did the step by step and everything seemed to install fine, but I'm stuck on loading and the console is telling me there is an error on line 206 of the .js file? I got this module working a few days ago but since updating it's stopped working and given me that error, any help is greatly appreciated

-Dave

nwootton commented 7 years ago

Hi Dave. Firstly sorry that the module is now misbehaving. Can you tell me - have you updated your MagicMirror to 2.1.1? If so, did you do a npm install after the update? And what was the ATCO you are using? It might be something in the name that's making the code unhappy!

davidnesbitt7 commented 7 years ago

Hey thanks for getting back to me, I'm running the latest version of MM, I did the npm install and everything looks to be pinging the API because it's recording requests on their side, just not displaying anything and giving me the error, the ATCO is '6200207230', thanks for the help

-Dave

nwootton commented 7 years ago

OK, so the issue is with the module handling the delays and realtime info. The ATCO code you gave me returns nulls for

"expected_departure_date": null,
"expected_departure_time": null,

and my first versions didn't handle this scenario. How comfortable are you with git(hub) - do you know how to clone a different branch to your device? If you are comfortable try using the 'HeadersIssue' branch and see if that addresses your problem.

This is what that branch gives me for your ATCO:

screen shot 2017-04-15 at 16 12 57
davidnesbitt7 commented 7 years ago

Hey Nick, yeah that's done it and it's back functioning again, thanks so much!! For anyone having the same issue I should probably note what the solution is..As Nick said copy the branch "HeadersIssue", for anyone not familiar with command line it's -->

git clone -b HeadersIssue https://github.com/nwootton/MMM-UKLiveBusStopInfo.git and again run npm install

Thanks again for the help

nwootton commented 7 years ago

Couple of quick follow up questions.

Do you use a single or multiple copies of the module in your mirror? Does the display list the correct bus stop name at the top of the module? Does the bus stop name stay there after a refresh/data reload?

Thanks.

davidnesbitt7 commented 7 years ago

I'm using a single copy of the module in my MM, although that could change in the future but for now it's one, It does have the right name at the top and stays after refresh, I however do not have the <header> class with departures in it is's just the stop name, but I can figure that out, I do have a bit of custom CSS I've written for this module if you'd like to see it? It's just including things like a font awesome icon, sorting out some overflow issues with longer bus stop names and some spacing

nwootton commented 7 years ago

The new version is supposed to have the bus stop name as a header rather than departures. If you want you can paste the css up here and I'll look at including it in the module.

davidnesbitt7 commented 7 years ago

Ah ok nice! I just stuck module: 'Departures' into my config file for now, css:

 .dest {
  max-width: 135px;
  overflow: hidden;
  padding-right: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.route {
  font-weight: bold;
  padding-right: 10px;
  text-align: left;
}
.route:before {
    content: '\f207';
    font-family: 'FontAwesome';
}
nwootton commented 7 years ago

Added your css into this branch:

screen shot 2017-04-18 at 12 28 48

Closing this now.