winstonma / MMM-HK-Transport-ETA

Estimated Time of Arrival (ETA) for the Hong Kong Transport. It uses the API provided by DATA.GOV.HK and support several Hong Kong transport.
GNU Affero General Public License v3.0
5 stars 1 forks source link

KMB api option not working? #6

Open tommy1223 opened 4 months ago

tommy1223 commented 4 months ago

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 commented 4 months ago

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

winstonma commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 3 months ago

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 commented 3 months ago

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  | > magicmirror@2.26.0 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 commented 3 months ago

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 commented 3 months ago

@tommy1223

Check the log on your terminal

tommy1223 commented 3 months ago

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

Thanks for all the help!