Open Murtsiboi opened 3 years ago
Nice :) Welcome to the MagicMirror community! This is still a part of my mirror setup so I'm interested in any ideas you have for it. It has worked well without any maintenance so I just haven't updated the code in a while.
I don't sort the stops so you should be able to order them in any order in the config by just changing the order of the stop id's in the array (but I'm not sure since I haven't touched it for sometime since it has worked for me).
If the HSL API gives the "päätepysäkki" where the bus is going it should be pretty easy to add to the UI. You can probably get it from the API but any of the busses that run on my stops works for me so I haven't checked that out. I can take a look at this when I have a chance but if someone else want's to contribute a change I'll happily merge one.
The translation for time remaining comes from the library that is already included in MagicMirror (not included in this module) so I don't really have a way to change that with this module other than doing some custom formatting without the lib and that would result in different formatting of time than the other modules in the mirror uses. But if you change it in the moment.js locale you get consistent formatting throughout the modules so that's good. I've configured mine like this:
stops: [43727, { id: 97679, name: "UI label for stop", minutesFrom: 5}],
with the "minutesFrom" added since the other stop is a bit further away and when I look at the timetable it's too late to get to a bus that will be on the stop in a minute or some seconds. This means the stop name for the second one is configured manually and not shown as it reads on the HSL API and busses that are less then 5 minutes from the stop are not shown. You could try configuring the minutesFrom to 1 to get rid of that "muutaman sekunnin päästä". It might be a reasonable change to always show <2mins as "now" or "nyt".
For future reference: looks like the API gives you this kind of name for the bus as well:
"pattern": {
"name": "225 to Leppävaaran asema (HSL:2111231)",
"route": {
"shortName": "225"
}
},
So changing const line = value.pattern.route.shortName;
to const line = value.pattern.name
in https://github.com/ZakarFin/mm-hsl-timetable/blob/master/node_helper.js#L81 would give you something like "225 to Leppävaaran asema (HSL:2111231)" instead of just the shortName which is the bus number.
Hi, I hadn't noticed that you replied!
I don't sort the stops so you should be able to order them in any order in the config by just changing the order of the stop id's in the array
I tried that earlier but it doesn't seem to work, at least for me. It's always the same numerical order from the stop ID's
What's that number you have in your config, marked with bold? stops: [43727, { id: 97679, name: "UI label for stop", minutesFrom: 5}],
That value.pattern.name change works, but it still shows that useless "(HSL:1234567)" part. No idea how to exclude that...
Also, there's one issue I forgot to mention earlier. There are some bus stops in Helsinki, where during the night there's no buses for 8-9 hours. And some stops which aren't used at all during weekends. When this happens, for some reason these stops only show the next bus when it's about 4-5 hours away. So until then, the title of the stop is still there, but there's no buses visible. Do you think it would be easy to make the stop disappear when there's nothing fetched from the API? Or is there a time limit within the module? Couldn't find any myself.
@Murtsiboi I started working on these ideas and at some point I realized that I have made so many changes that I decided to create a new module: https://github.com/alonsourbano/publika
The idea that I had was a bit different so I preferred to divert the project.
Good job @alonsourbano. I'll definitely take a closer look at your version at some point.
Hi!
Really like this module, seeing that this existed made me finally make my own magicmirror. Some improvement ideas:
The order of stops is currently always listed numerically by the stopID number. It would be great to be able to switch around the order.
Would be great to see the end stop / direction of each bus. I have some stops nearby that have buses going all over Helsinki, and I can never remember which ones of them go to a specific direction. Right now I have a list of buses under the timetable as a text, to see which ones are the right ones.
The way it translates relative time to Finnish, is a bit long. I think "nyt" is way better than "muutaman sekunnin päästä". Also "3 min" is better than "kolmen minuutin päästä" in my opinion. Right now my workaround has been to edit the fi.js file in moment/locale.
I know you probably aren't that invested in this project anymore, but just some thoughts. Maybe someone else who is better in javascript etc than I am, will pick it up.