Giter Site home page Giter Site logo

Thoughts about mm-hsl-timetable HOT 3 OPEN

zakarfin avatar zakarfin commented on July 20, 2024
Thoughts

from mm-hsl-timetable.

Comments (3)

ZakarFin avatar ZakarFin commented on July 20, 2024

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

from mm-hsl-timetable.

ZakarFin avatar ZakarFin commented on July 20, 2024

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.

from mm-hsl-timetable.

Murtsiboi avatar Murtsiboi commented on July 20, 2024

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.

from mm-hsl-timetable.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.