Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck on loading trains message #1

Closed
tomdpi opened this issue Jun 28, 2017 · 22 comments
Closed

Stuck on loading trains message #1

tomdpi opened this issue Jun 28, 2017 · 22 comments
Assignees

Comments

@tomdpi
Copy link

tomdpi commented Jun 28, 2017

Module is loading but never gets past Loading Trains message. Details have been put in through the transport API site and return the 200 response expected. Have stripped back to the mandatory config fields only but no change.
config entry:
{
module: "MMM-UKNationalRail",
position: "bottom_left",
config: {
stationCode: "HUD",
app_id: "myAppId",
app_key: "myAppKey"
}
}

@nwootton
Copy link
Owner

Ok, I'll try and look at that today.

@nwootton
Copy link
Owner

Did you do the npm install in the module directory prior to running the Mirror?

Using the following config:

	{
		module: 'MMM-UKNationalRail',
		position: 'bottom_left',
		config: {
	      		stationCode: 'HUD', 							// CRS code for station
			app_id: 'xxxxxxxx', 							// TransportAPI App ID
			app_key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 	// TransportAPI App Key
		}
	},

I get it to connect and display without issues.

screen shot 2017-06-28 at 11 53 59

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

I did, i've just run it again just in case but no change
image

Using the Bus module with no issues.

@nwootton
Copy link
Owner

nwootton commented Jun 28, 2017

What other modules are you running? Is this a fresh install or an old install? Have you done an update recently?

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

alert
updatenotification
clock
calendar
currentweather
weatherforecast
newsfeed
MMM-UKLiveBusStopInfo
MMM-UKNationalRail

@nwootton
Copy link
Owner

Can you copy your complete config (minus API keys) - I've stripped my test config down to the items listed and it's still runs.

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

var config = {
        port: 8080,
        ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "192.168.0.3", "192.168.0.2", "$

        language: "en",
        timeFormat: 24,
        units: "metric",

        modules: [
                {
                        module: "alert",
                },
                {
                        module: "updatenotification",
                        position: "top_bar"
                },
                {
                        module: "clock",
                        position: "top_left"
                },
                {
                        module: "calendar",
                        header: "Calendar",
                        position: "top_left",
                        config: {
                                calendars: [
                                        {
                                                symbol: "calendar-check-o ",
                                                url: " "
                                        }
                                ]
                        }
                },
                {
                        module: "currentweather",
                        position: "top_right",
                        config: {
                                location: "Huddersfield",
                                locationID: "2646458",  //ID from http://www.openweathermap.o$
                                appid: " "
                        }
                },
                {
                        module: "weatherforecast",
                        position: "top_right",
                        header: "Weather Forecast",
                        config: {
                                location: "Huddersfield",
                                locationID: "2646458",  //ID from http://www.openweathermap.o$
                                appid: " "
                        }
                },
                {
                        module: "newsfeed",
                        position: "bottom_bar",
                        config: {
                                feeds: [
                                        {
                                                title: "BBC",
                                                url: "http://feeds.bbci.co.uk/news/rss.xml"
                                        }
                                ],
                                showSourceTitle: true,
                                showPublishDate: true,
                                ignoreOlderThan: 86400000
                        }
                },
                {
                        module: "MMM-UKLiveBusStopInfo",
                        position: "bottom_left",
                        header: "Departures",
                        config: {
                                        atcocode: "  ", //removed for sharing
                                        app_id: " ",
                                        app_key: " ",
                                        limit: 5,
                                        nextBuses: "yes",
                                        showRealTime: false,
                                        showDelay: false
                                }
                },
                {
                        module: "MMM-UKNationalRail",
                        position: "bottom_left",
                        config: {
                                        stationCode: "HUD",
                                        app_id: " ",
                                        app_key: " "
                                }
                }
        ]

};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}




@nwootton
Copy link
Owner

nwootton commented Jun 28, 2017

I've used a random bus stop for the atco and replaced the various API keys with my own and it all works. Calendar errors because of lack of url, but that's expected.
screen shot 2017-06-28 at 12 45 45
Only thing I can think of is that you have exceeded your daily allowance by using the nextBuses = "yes" for the bus stop module. This is VERY expensive (see Notes in the module) and will mean that you use up your ENTIRE daily Transport API credits in about 8 hours alone. Add the additional 1 point every 5 minutes for the rail module and this drops it to ~ 7.5 hours. So by 07:30 you could have run out of credits.

Are you sure the bus module is also working correctly?

Check the stats on the Transport API to see the usage as well - that will tell you if you are exceeding the quota.

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

I wondered about this, however the mirror isnt running all the time as i'm still setting up - i only installed on Monday. I turned it on around 10 am this morning and it never worked from that point. No usage warnings on transportAPI account either.

I had to use nextBuses as without that the API doesnt return any data for my stop. In any case, the buses are loading, which i presume they wouldnt if i'd used my daily hits.

@nwootton
Copy link
Owner

nwootton commented Jun 28, 2017

Ok next step: If you run the mirror in server mode, you can use a browser to see the console messages. Instead of running it via 'npm start' run it using 'node serveronly'.

Point a normal web browser at the ip address:8080 of the mirror and it should appear. Do you know how to inspect a web page via a browser? If so have a look at the console and see if there are any errors being output.

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

I'm already running serveronly mode - no errors showing there. There are however errors in the browser console

:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:248 Uncaught TypeError: Cannot read property 'all' of undefined
    at Class.processTrains (:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:248)
    at Class.socketNotificationReceived (:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:361)
    at module.js:183
    at n.<anonymous> (socketclient.js:26)
    at n.emit (socket.io.js:2)
    at n.onevent (socket.io.js:3)
    at n.MMSocket.self.socket.onevent (socketclient.js:19)
    at n.onpacket (socket.io.js:3)
    at n.<anonymous> (socket.io.js:3)
    at n.emit (socket.io.js:2)
:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:248 Uncaught TypeError: Cannot read property 'all' of undefined
    at Class.processTrains (:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:248)
    at Class.socketNotificationReceived (:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:361)
    at module.js:183
    at n.<anonymous> (socketclient.js:26)
    at n.emit (socket.io.js:2)
    at n.onevent (socket.io.js:3)
    at n.MMSocket.self.socket.onevent (socketclient.js:19)
    at n.onpacket (socket.io.js:3)
    at n.<anonymous> (socket.io.js:3)
    at n.emit (socket.io.js:2)

@nwootton
Copy link
Owner

Weird - that is an old error caused by the module NOT handling empty responses from the TransportAPI - generally due to train operators not providing information in a consistent manner. Let me go and check the various GIT branches..... How did you download the module BTW?

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

Followed the steps on the Readme

@nwootton
Copy link
Owner

OK. Let me get back to you.

@nwootton
Copy link
Owner

nwootton commented Jun 28, 2017

I get the error you describe above :

MMM-UKNationalRail.js:248 Uncaught TypeError: Cannot read property 'all' of undefined
    at Class.processTrains (MMM-UKNationalRail.js:248)
    at Class.socketNotificationReceived (MMM-UKNationalRail.js:361)
    at module.js:183
    at n.<anonymous> (socketclient.js:26)
    at n.emit (universalModuleDefinition:2)
    at n.onevent (universalModuleDefinition:3)
    at n.MMSocket.self.socket.onevent (socketclient.js:19)
    at n.onpacket (universalModuleDefinition:3)
    at n.<anonymous> (universalModuleDefinition:3)
    at n.emit (universalModuleDefinition:2)

by putting in the wrong app_id or app_key. Can you check these are correct and are properly quoted?

@nwootton nwootton self-assigned this Jun 28, 2017
@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

yeah they look ok, they're exactly the same as the entries in Bus times. I tried generating a new API key in case that was it but got the same issue. All quotes look ok, same as the config above

@nwootton
Copy link
Owner

Ok I've released a version with better error handling and debug capabilities. Firstly you'll need to do a git pull && npm install to make sure you have the latest version. You'll also need to add

	debug:	false

to your NationalRail config in the mirror config file. Hopefully we can then get a better idea of where the error is happening. Everything I do this end indicates that the request being made is wrong - either _key, or _id or even station code. BUT the config you gave me doesn't seem to support this.

Let me know what the error is in the console.

@nwootton
Copy link
Owner

There is also a 'URL Request is: ' output in the console log. If you copy this link and paste it into a browser it should return the JSON for the station departures.

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

Ok, i now get a 'no info about station returned' message. No messages to STDOUT or the browser console. I set the debug setting to true, still don't see anything on STDOUT but get these in the console

:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:324 Objectdata: Array(0)length: 0__proto__: Array(0)concat: function concat()arguments: nullcaller: nulllength: 1name: "concat"__proto__: function ()constructor: function Array()arguments: nullcaller: nullfrom: function from()isArray: function isArray()length: 1name: "Array"of: function of()prototype: Array(0)Symbol(Symbol.species): (...)get Symbol(Symbol.species): function [Symbol.species]()__proto__: function ()copyWithin: function copyWithin()entries: function entries()every: function every()fill: function fill()filter: function filter()find: function find()findIndex: function findIndex()forEach: function forEach()includes: function includes()indexOf: function indexOf()join: function join()keys: function keys()lastIndexOf: function lastIndexOf()length: 0map: function map()pop: function pop()push: function push()reduce: function reduce()reduceRight: function reduceRight()reverse: function reverse()shift: function shift()slice: function slice()some: function some()sort: function sort()splice: function splice()toLocaleString: function toLocaleString()toString: function toString()unshift: function unshift()Symbol(Symbol.iterator): function values()Symbol(Symbol.unscopables): Object__proto__: Objectmessage: "No info about the station returned"stationName: "Departures"timestamp: Wed Jun 28 2017 14:23:49 GMT+0100 (GMT Summer Time)__proto__: Objectconstructor: function Object()hasOwnProperty: function hasOwnProperty()isPrototypeOf: function isPrototypeOf()propertyIsEnumerable: function propertyIsEnumerable()toLocaleString: function toLocaleString()toString: function toString()valueOf: function valueOf()__defineGetter__: function __defineGetter__()__defineSetter__: function __defineSetter__()__lookupGetter__: function __lookupGetter__()__lookupSetter__: function __lookupSetter__()get __proto__: function __proto__()set __proto__: function __proto__()
processTrains @ :8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:324
:8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:325 ^^^^^^^^^^^^^^^^^^^^^^^
processTrains @ :8080/modules/MMM-UKNationalRail//MMM-UKNationalRail.js:325

No sign of the URL Request is message though...

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

Second pull and install picked up the change in your commit. I'm sorry to say this a big fat user error - in the application key being incorrect (1 and l look exactly the same in Putty).

Thanks for the great support and sorry for the wasted time

@tomdpi tomdpi closed this as completed Jun 28, 2017
@nwootton
Copy link
Owner

nwootton commented Jun 28, 2017

Ok. Bit worried that it took 2 pulls, but glad it's working. Have a good day and enjoy your mirror.

@tomdpi
Copy link
Author

tomdpi commented Jun 28, 2017

Threw me a bit too:

/MagicMirror/modules/MMM-UKNationalRail $ git pull
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 11 (delta 5), reused 10 (delta 4), pack-reused 0
Unpacking objects: 100% (11/11), done.
From https://github.com/nwootton/MMM-UKNationalRail
   483bb38..5c7d298  master     -> origin/master
Updating 483bb38..5c7d298
Fast-forward
 .gitignore            |   2 +
 MMM-UKNationalRail.js | 768 ++++++++++++++++++++++++++++++++++++++---------------------------------
 README.md             |  13 +-
 3 files changed, 424 insertions(+), 359 deletions(-)
~/MagicMirror/modules/MMM-UKNationalRail $ git pull
Updating 5c7d298..d747e55
Fast-forward
 MMM-UKNationalRail.js | 9 +++++++++
 1 file changed, 9 insertions(+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants