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

KMB api option not working? #6

Open
tommy1223 opened this issue Mar 4, 2024 · 9 comments
Open

KMB api option not working? #6

tommy1223 opened this issue Mar 4, 2024 · 9 comments

Comments

@tommy1223
Copy link

I am trying to add the module using the KMB API for bus ETA. The magic mirror loads up but the bus ETA part keep loading without output. Am I missing anything? Any log I should capture for debugging?

Thanks in advance!

@winstonma
Copy link
Owner

I think log would be useful. But before that I think there are several ways to troubleshoot

  • Try adding the followng in config/config.js
		{
			module: "MMM-HK-Transport-ETA",
			position: "top_right",
			config: {
				// See 'Configuration options' for more information.
				transportETAProvider: 'kmb',
				sta: 'NA06-N-1300-0'
			}
		},

If this doesn't work, then you may need to upgrade MagicMirror and try again.

@winstonma
Copy link
Owner

winstonma commented Mar 5, 2024

BTW let me explain a bit more on getting the sta value on the comment above.

  1. Go to kmb_eta page

  2. Enter the bus number, then press Submit Query button, then you will see the direction of the bus. If you are looking for opposite direction, press the Switch Direction button
    image

  3. After choosing the right direction, go to Choose a route variant: and select the variant (normally the first one)

  4. Next, inChoose a stop in the list:, select your stop
    image

  5. On the rightmost of the stop name, you find see the NA06-N-1300-0, that is the stop name

Hope this helps

@tommy1223
Copy link
Author

Hi @winstonma , thanks a lot for the reply.

I did followed the instructions of putting the options and taking the station code. Let me capture you the code later today.

For log capturing, which log should I observe to help find the error?

@winstonma
Copy link
Owner

By the way did you upgrade MagicMirror to the latest version?

For log capturing I think it would be very interesting. First of all you need to run the server mode. According to the last step of the MagicMirror Manual Installation, you need to run the following command in terminal

npm run server .

At the end of the command you will see a browser url (normally http://localhost:8080)

Next, you need to Open Google Chrome, then open DevTool console (using hotkey Ctrl + Shift + J or Cmd + Option + J), next you paste the url on the url bar and then press enter. And see if there are some weird log in Chrome. Also the terminal log would be useful too.

@tommy1223
Copy link
Author

tommy1223 commented Mar 10, 2024

By the way did you upgrade MagicMirror to the latest version?

For log capturing I think it would be very interesting. First of all you need to run the server mode. According to the last step of the MagicMirror Manual Installation, you need to run the following command in terminal

npm run server .

At the end of the command you will see a browser url (normally http://localhost:8080)

Next, you need to Open Google Chrome, then open DevTool console (using hotkey Ctrl + Shift + J or Cmd + Option + J), next you paste the url on the url bar and then press enter. And see if there are some weird log in Chrome. Also the terminal log would be useful too.

I have just check that my MagicMirror is up to date. My config.js looks like this:

let config = {
	address: "localhost",	// Address to listen on, can be:
							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
							// - another specific IPv4/6 to listen on a specific interface
							// - "0.0.0.0", "::" to listen on any interface
							// Default, when address config is left out or empty, is "localhost"
	port: 8080,
	basePath: "/",	// The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
									// you must set the sub path here. basePath must end with a /
	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"],

	useHttps: false,			// Support HTTPS or not, default "false" will use HTTP
	httpsPrivateKey: "",	// HTTPS private key path, only require when useHttps is true
	httpsCertificate: "",	// HTTPS Certificate path, only require when useHttps is true

	language: "en",
	locale: "en-US",
	logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
	timeFormat: 24,
	units: "metric",

	modules: [
		{
			module: "clock",
			position: "middle_center"
		},
		{
			module: "weather",
			position: "top_left",
			header: "Weather Forecast",
			config: {
				weatherProvider: "openweathermap",
				type: "forecast",
				locationID: "1819730", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
				apiKey: ""
			}
		},
		{
			module: "MMM-HK-Transport-ETA",
			position: "top_right",
			config: {
				transportETAProvider: 'kmb',
				sta: 'KE02-E-1000-0'
			}
		},
	]
};

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

I guess it looks normal? I also used the config check function and no syntax error is found here.

@tommy1223
Copy link
Author

tommy1223 commented Mar 10, 2024

I also captured the logs from pm2 logs:

PM2      | Change detected on path config/config.js for app MagicMirror - restarting
PM2      | Stopping app:MagicMirror id:0
0|MagicMirror  | /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
PM2            | pid=3853 msg=failed to kill - retrying in 100ms
PM2            | App [MagicMirror:0] exited with code [0] via signal [SIGINT]
PM2            | pid=3853 msg=process killed
PM2            | App [MagicMirror:0] starting in -fork mode-
PM2            | App [MagicMirror:0] online
0|MagicMirror  | > [email protected] start
0|MagicMirror  | > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
0|MagicMirror  | [10.03.2024 23:55.08.608] [LOG]   Starting MagicMirror: v2.26.0
0|MagicMirror  | [10.03.2024 23:55.08.621] [LOG]   Loading config ...
0|MagicMirror  | [10.03.2024 23:55.08.629] [DEBUG] config template file not exists, no envsubst
0|MagicMirror  | [10.03.2024 23:55.08.639] [LOG]   Loading module helpers ...
0|MagicMirror  | [10.03.2024 23:55.08.644] [LOG]   No helper found for module: clock.
0|MagicMirror  | [10.03.2024 23:55.08.646] [LOG]   No helper found for module: weather.
0|MagicMirror  | [10.03.2024 23:55.08.946] [LOG]   Initializing new module helper ...
0|MagicMirror  | [10.03.2024 23:55.08.947] [LOG]   Module helper loaded: MMM-HK-Transport-ETA
0|MagicMirror  | [10.03.2024 23:55.08.953] [LOG]   All module helpers loaded.
0|MagicMirror  | [10.03.2024 23:55.08.972] [LOG]   Starting server on port 8080 ...
0|MagicMirror  | [10.03.2024 23:55.09.402] [LOG]   Server started ...
0|MagicMirror  | [10.03.2024 23:55.09.404] [LOG]   Connecting socket for: MMM-HK-Transport-ETA
0|MagicMirror  | [10.03.2024 23:55.09.408] [LOG]   Starting node helper for: MMM-HK-Transport-ETA
0|MagicMirror  | [10.03.2024 23:55.09.415] [LOG]   Sockets connected & modules started ...
0|MagicMirror  | [10.03.2024 23:55.09.442] [LOG]   Launching application.
0|MagicMirror  | Warning: vkCreateInstance: Found no drivers!
0|MagicMirror  | Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
0|MagicMirror  |     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
0|MagicMirror  |     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:458)
0|MagicMirror  |     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
0|MagicMirror  |     at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
0|MagicMirror  |     at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)

I don't really find module related errors.

@winstonma
Copy link
Owner

I have just check that my MagicMirror is up to date. My config.js looks like this:

I tried your config and here is the output on my side

image

Could you run the following command and then rerun MagicMirror?

cd modules/MMM-HK-Transport-ETA
npm install

@winstonma
Copy link
Owner

winstonma commented Mar 10, 2024

@tommy1223

  • Make the following change in config/config.js
// ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],	// Set [] to allow all IP addresses
ipWhitelist: [],        // Set [] to allow all IP addresses
  • On terminal, run npm run server . instead of using PM2 for debugging purpose
  • Open Google Chrome on your desktop, and then connect to http://<ip of your MagicMirror server>:8080/

Check the log on your terminal

@tommy1223
Copy link
Author

@winstonma Magically, after I changed the config.js address to 0.0.0.0, it starts popping up information.

Thanks for all the help!

@tommy1223 tommy1223 reopened this Mar 10, 2024
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