Closed essknete closed 1 year ago
You need node 18 to run this (at least that what worked for me)
Thanks a lot for your input, I updated node to the newest version, but it still doesn't work for me:
file:///home/XXXXXXXXX/MagicMirror/modules/MMM-PublicTransportBerlin/convenience/query_stations.mjs:2 import { createClient } from "hafas-client"; ^^^^^^^^^^^^ SyntaxError: Named export 'createClient' not found. The requested module 'hafas-client' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:
import pkg from 'hafas-client'; const { createClient } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
Node.js v19.7.0
Oh, the problem is that the query_stations script already requires hafas-client v6. I didn't think about that when I made the change. I think I can build a fix tonight.
It should work with the last commit. @essknete , please let us know if it works for you.
@KristjanESPERANTO thanks for your effort! it works for me now to search for the stationID, but if I insert the 6-digit ID to my config.js, than nothing shows up and no information is visible on the MagicMirror. BTW: with the old 12-digit stationID it works fine, but the warning shows up.
Which station is it?
The 12-digit stationID will stop working with the next big update of the module. It would be very good for us to know what the problem is with your installation. It would be good for us to know why the long ID doesn't work for you.
Which station is it?
I'm using 2 different stations, because my kids using different buses, but both (new ID's) don't work for me... stationId: "900000085154", // old works fine with warning message stationId: "732275", // new don't works at all.
The 12-digit stationID will stop working with the next big update of the module. It would be very good for us to know what the problem is with your installation. It would be good for us to know why the long ID doesn't work for you.
the old long (12 digit) ID works fine at the moment... :)
what station names are you searching for?
what station names are you searching for?
as I wrote before, I'm able to find the new station ID with the script! so that's not the issue... but if you like to check this, than look for: me ;)
OK, I see the problem. To be more precise, even two. Firstly, I made a mistake when selecting the hafas-profile. And secondly, there still seems to be 12-digit IDs, as in this example. So the warning we added a few days ago isn't correct for everyone.
I'll fix the script and remove the warning.
EDIT: Okay, it's a little more complicated. I'll do some more research about how to handle old and new IDs.
@essknete, you can use the stationId 900085154.
Sorry for the trouble 🤦😅
I should have tested the changes better beforehand. But it should work now.
OK, I see the problem. To be more precise, even two. Firstly, I made a mistake when selecting the hafas-profile. ~And secondly, there still seems to be 12-digit IDs, as in this example. So the warning we added a few days ago isn't correct for everyone.~
I'll fix the script ~and remove the warning~.
EDIT: Okay, it's a little more complicated. I'll do some more research about how to handle old and new IDs.
@essknete, you can use the stationId 900085154.
Thanks, now it works for me fine!
Sorry for the trouble 🤦😅
no problem and thanks for your effort in this case. ;)
Very good! I close the ticket now. Have a nice weekend! :slightly_smiling_face:
Hi, when I start the script by typing node ./convenience/query_stations.mjs, then I get the following: import { createClient } from "hafas-client"; ^^^^^^^^^^^^ SyntaxError: Named export 'createClient' not found. The requested module 'hafas-client' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:
import pkg from 'hafas-client'; const { createClient } = pkg;
Any ideas for help?