ZakarFin / mm-hsl-timetable

MagicMirror module for HSL timetables
MIT License
5 stars 3 forks source link

Thoughts #1

Open Murtsiboi opened 3 years ago

Murtsiboi commented 3 years ago

Hi!

Really like this module, seeing that this existed made me finally make my own magicmirror. Some improvement ideas:

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.

ZakarFin commented 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.

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".

ZakarFin commented 3 years ago

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.

Murtsiboi commented 3 years ago

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.

alonsourbano commented 2 years ago

@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.

ZakarFin commented 2 years ago

Good job @alonsourbano. I'll definitely take a closer look at your version at some point.