balassy / MMM-Futar

MagicMirror module that displays Budapest public transport information.
MIT License
5 stars 2 forks source link

More routes in one module / show line distruptions #1

Closed radokristof closed 2 years ago

radokristof commented 6 years ago

Loving this module!

However would be great if multiple routes (from the same stop) can be seen together in the same moudule. Also showing a little exclamation mark next to a line which is late / has some distruption (BKK providing info like this) would be great.

balassy commented 5 years ago

Thanks for the kind words, Kristóf!

Currently the module displays the predicted times, so if a bus is in late (and the BKK API provides that information), than the time when the actual bus is expected in the stop will be displayed.

It's a good idea to do display service disruptions as well, I have to check whether that information is available through some other API.

Currently you can add this module multiple times to your mirror (even to different positions), what would be the benefit of displaying multiple routes from the same stop?

radokristof commented 5 years ago

Thanks for your response! Yes I thought it works that way because it shows the actual departure like in the BKK Futar app. Why I thought about that to make some way to show multiple lines in one module (like adding more routeId to one module) because for me it doesnt really matter which line I take from that stop, it just matters which line comes first. Anyway now I’m using that way as you described, I add multiple modules to the mirror. However it seems more 'logic' to me that one module represents one stop with one (or more) selected lines.

I’ll soon make a PR to make the description of the routeId more accurate (showing a way for everyone to get these datas).

Thanks for your work!

zttk commented 5 years ago

Dear RadoKristof, Balassy

I just built my magic mirror last week, and this is one of the must have modules for our family. Unfortunately from our stop multiple bus lines are leaving. I tried adding the module multiple times as you suggested above, but it is not working for me. Only the first line is displayed. Could you please check and advise what is wrong with my config?

I even copied the module to MMM-Futar2 folder, hoping is would make it work, but no change. The second part is not working even if the module is called MMM-Futar or MMM-Futar2.

{ module: "MMM-Futar", position: "top_right", config: { stopId: "BKK_F04804", routeId: "BKK_1885", minutesAfter: 90, updateInterval: 60000, showHead: true, showSymbolInHead: true, showSymbolInStopTime: false, maxNumberOfItems: 3, align: "right", fade: true, fadepoint: 0.25 } }, { module: "MMM-Futar2", position: "top-right", config: { stopId: "BKK_F04804", routeId: "BKK_0880", mitesAfter: 90, updateInterval: 60000, showHead: true, showSymbolInHead: true, showSymbolInStopTime: false, maxNumberOfItems: 3, align: "right", fade: true, fadepoint: 0.25 } },

Many Thanks, Tamás

radokristof commented 5 years ago

Think I found the problem in your setup. The second module name should be MMM-Futar as well, not Futar2.

zttk commented 5 years ago

Thanks, but as I mentioned above it is not. I tried with normal MMM-Futar as well.

radokristof commented 5 years ago

Then I'll try this later today. No errors in the log?

zttk commented 5 years ago

It also crashes my newsfeed module, with below error:

TypeError: Cannot read property 'getElementsByClassName' at moduleNeedsUpdate (main.js:176) at main.js:144 at new Promise ( at updateDomWithContent(main.js:137)at main.js:119 at

But if I remove the second futar module all ok.

radokristof commented 5 years ago

And if you try two Futar modules with 'MMM-Futar' module name? Also try replacing all " with ' in stopId and routeId as well. I'm also relatively new to MagicMirror so I can just only help you out with instructions which I try if I have the same problem as you. Also delete that Futar2 folder in modules, that's not needed, I'm using multiple modules without a problem. The routeIds seems fine for this stop as well. Maybe you can try placing the second module somewhere else where you don't have any modules, replace the two routeId, see if that helps

zttk commented 5 years ago

I tried with no luck (changed position for second block and replaced "" with ''. Could you please share your sample how did you make it work? Maybe it is something wiht the heading or settings.

I also tried removing the news module, as that is not working when second Futar module is added, but even if news feed is removed, second Futar is not working.

zttk commented 5 years ago

Found it! Apologies really stupid mistake..

In the second module I had mitesAfter instead of minutesAfter.

radokristof commented 5 years ago

Thought it might be just some typo. Glad that it is working now!

balassy commented 5 years ago

@zttk Tamás, I'm happy to hear that it is working now!

balassy commented 5 years ago

To summarize the ideas:

Did I miss something?

radokristof commented 5 years ago

No this two was my main idea :) Yes, if it's that way, it needs to indicate every departure time line by line. If it's possible, the best would be I think:

radokristof commented 5 years ago

@balassy One thing to add: Don't know fully how these services work at BKK, but maybe you don't have to mess with BKK Info. I'm using the mobile app (Futar) and the app can show line disprutions as well (exclamation mark and a little description). So this data might be found in the Futar API somewhere...

balassy commented 5 years ago

I managed to capture data about increased journey times and tram replacement buses. These are represented as alerts in the API, have short headers and longer descriptions both in Hungarian and English. Stay tuned… :)

increased journey time 2 increased journey time replaced by buses 2 replaced by buses

radokristof commented 5 years ago

Thanks :) I'm excited to see how it works in reality!

radokristof commented 5 years ago

I managed to capture data about increased journey times and tram replacement buses. These are represented as alerts in the API, have short headers and longer descriptions both in Hungarian and English. Stay tuned… :)

increased journey time 2 increased journey time replaced by buses 2 replaced by buses

Thanks for the screenshots! These are the 'alerts' I have thought of. Thanks for your work and keeping this module up-to-date!

balassy commented 5 years ago

@radokristof Kristóf, I am happy to announce the release of version 1.3.0 which brings the following improvements:

Please check the README for screenshots and description about the new features and configuration settings.

I hope you like these improvements, feel free to send feedback and comments.

balassy commented 5 years ago

Resolved with release 1.3.0: https://github.com/balassy/MMM-Futar/releases/tag/1.3.0

zttk commented 5 years ago

Fantastic new features, thanks a lot! All very useful and can be easily configured.

I updated my module already but I’m still playing with the new options. So far so good!

Thanks again for these new features!

Tamás

From: György Balássy [mailto:notifications@github.com] Sent: Friday, December 14, 2018 6:26 AM To: balassy/MMM-Futar Cc: TAMÁS ZOLTÁN; Mention Subject: Re: [balassy/MMM-Futar] More routes in one module / show line distruptions (#1)

@radokristof https://github.com/radokristof Kristóf, I am happy to announce the release of version 1.3.0 which brings the following improvements:

Please check the README for screenshots and description about the new features and configuration settings.

I hope you like these improvements, feel free to send feedback and comments.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/balassy/MMM-Futar/issues/1#issuecomment-447217686 , or mute the thread https://github.com/notifications/unsubscribe-auth/AqgP-sfLtfm5GwnXsg147ww4Ww2skaAAks5u4zZZgaJpZM4X9VRs . https://github.com/notifications/beacon/AqgP-ib46QlFfqqJ_eknNFj5VxxWWQPGks5u4zZZgaJpZM4X9VRs.gif

radokristof commented 5 years ago

Thansk @balassy ! That what I was looking for! Now it looks very neat and clean (with all the departures).

radokristof commented 5 years ago

@radokristof Kristóf, I am happy to announce the release of version 1.3.0 which brings the following improvements:

  • If you specify only the stopId in config.js, but not specify the routeId, then all departures will be displayed from that given stop.
  • Using the new showRouteNameInStopTime option you can configure the module to display not only the route sign, but also the name of the route near every departure time. It can be useful if you don't specify any routeId in the config. This option is disabled by default.
  • Using the new coloredRouteNameInStopTime option you can even display the route name in the color that matches the route type near every departure time. This option is similar to the coloredSymbolInStopTime option and is enabled by default, though it only has any effect if the showRouteNameInStopTime is set to true.
  • Service disruptions (aka. operational alerts) are displayed by default near every departure time. This feature can be customized using the new alerts object in the configuration. Currently the module displays only the short header of the alert, because I could not find the ideal layout to display the detailed description the Futár API provides.

Please check the README for screenshots and description about the new features and configuration settings.

I hope you like these improvements, feel free to send feedback and comments.

Everything works fine as you described, now I had time to play it with a little! Love this update!

I haven't seen any service distruption yet, just from your screenshot. For me, this short header is enough to display what is causing the distruption (we don't need the long one I think). However wouldn't be better if the disruption is displayed under the time of arrival (with a little indent, maybe smaller font and keep the yellow font)? I don't know if this can work, and if yes, how...

Also if you have multiple departures from a stop (you haven't specified the routeId), the header should be auto-off or maybe it should show every line symbol which is in the current arrival list? Because now, it shows one, I think the most recent one.

balassy commented 5 years ago

Thanks for the feedback, @radokristof.

I added the alert text to the right of the departure time to save some vertical real estate on the screen. The same reason why the maxNumberOfItems configuration option exists. Let's wait for more feedback, and if it turns out that people prefer more vertical layout than horizontal, then I will reorganize the layout. If this is important for you, please feel free to create a separate Issue for it here on Github, so people can vote for it.

Regarding your second suggestion for the header: I prefer keeping the configuration options independent from each other, instead of implementing logic that connects them together acting as a hidden magic for the user. What you described is achievable today by manually hiding the header using the showHead configuration option.

The original idea behind the header was to provide a visual separator that also has a meaning, so without using the standard, underlined module header. Currently the header displays the route name and the sign for the next departure, because I found that displaying every possible route symbol and name would make the screen crowded. Also, the module by default displays the departure for the next 50 minutes, and if there is no departure for a specific route in that timeframe, the Futár API does not return it to the module, so it would be misleading. If you want to display all route names for the selected stop, I recommend using the standard module header.

Hope this helps.

radokristof commented 5 years ago

Now it makes more clear for me, thanks @balassy. First of all, these are just really suggestions to make it the module more 'general' and customizable. For me it is perfect as it is right now!

Regarding the layout. I know that this can cause other problems, like you will have less departure time when an alert will be shown under the departure time (or it will 'grow' in size, if it just truncates the departures regarding how many departures are in the list, not by the size of lines) and also it will cause misleading how the maxNumberOfItems works. Maybe a better option to have the ability to show only an exclamation mark next to the departure time. With this, the lines won't grow that much if there is a distruption and you still have some basic info (as I can see BKK only uses the increased journey time mostly in the alerts). Or maybe show a custom symbol next to the exclamation mark.

I don't know how others (for example you) use MagicMirror, but in general I want to achieve to only show modules on the edges of the screen and have a black middle zone.

The original idea behind the header was to provide a visual separator that also has a meaning, so without using the standard, underlined module header.

Now that makes sense also. Yes after you wrote that, it makes clear that listing all line symbols in the header is not so practical (e.g.: for stops which have a lots of line) and it will won't look good also. However as you wrote, that you don't have a visual seperator between the modules. Maybe another and easier, cleaner looking solution would be to be able to set the header to a custom text (Stop name), like in your MMM-Bubi module you can override the dock name.

balassy commented 5 years ago

Thanks for the suggestions, @radokristof. Actually I was considering displaying only the exclamation mark icon, and not the text, exactly because most of the time increased journey time is the message. However it seems to me that for tram and metro lines this message is very rare, but replacement buses is the most frequent. What I was thinking is that in practice you can not do much with an increased journey time, but if your favorite tram, metro or rail is not operating, than you may want to choose another route, or at least know that you probably have to board onto the replacement buses in a different stop.

My current ideas:

What do you think?

radokristof commented 5 years ago

Exactly what I thought! I also thought of that you can't query all of the alert types from the API. However we can add it one-by-one as we discover new alerts. Also which is frequent alert (during mostly protests) is terelés (hatósági zárás). I don't know how they call it in English.

So yes in general I think the best would be:

Regarding the replacement buses, if you want to stick with a general idea, I think it can be the same as above. If we have an icon for that (in that case it can be a bus icon, next to the exclamation mark, you will know that this means replacement buses - because you can see the tram icon in the front of the line) it will be easy to understand and no need to mess around with 'special' cases, like trams and metro. Ps.: Usually in the mail which Futár sends when my 'favorite' line has some disruptions, they usually (for tram and metro lines mostly) show an alternate route. I don't know that this is represented in the API or not, but if yes, we could show that also next to the disruption icons on the module (that way you will exactly now that there is an outage plus you will know which line you should take) and that will not take us as many space as the whole sentence now.

balassy commented 5 years ago

It seems that there are no finite list of alert types, as I discover newer and newer reasons about every day on https://bkk.hu/bkk_info/. Given that I don't think we find appropriate icons for even the most frequent alerts.

What's more what may be a frequent event on one route can be an extraordinary one on another route; events that are less important for one person may be critical for someone else. So I don't think we should do a generic filtering or hiding of events.

In my mind alerts should be exceptional, but important, so I want to be very careful about when to not show them.

Let's use the current implementation for a while, gather more experience and collect feedback from other users as well.

radokristof commented 5 years ago

Sure! Or think of any alternative ways to reduce the length of one row.

GattoJohnny commented 4 years ago

Let me warm it up a bit.

MMM-Futar_20191119-01

Unfortunately I failed pimping the CSS to limit the length of alerts to X characters. Truncated messages still look better than the above pile up. I wonder if you can add a variable in the config file to make long texts shorter.

balassy commented 4 years ago

@GattoJohnny What do you think about using the text-overflow CSS property to truncate the text? https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/ https://css-tricks.com/almanac/properties/t/text-overflow/

GattoJohnny commented 4 years ago

Thanks for the hint. It does more or less what I originally asked for.

.MMM-Futar .alert-header {
  max-width: 250px;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

MMM-Futar_20191120-01

Apart from the incorrect vertical alignment of the exclamation mark, which is a cosmetic error and might be fixed somehow, I figured that this was not the right approach. The overall width of the module depends on several components. Of course, the alert message has the greatest impact, but departure text can also vary: close to the start time text changes and expands the overall width by 90 pixels or more.

MMM-Futar_20191120-02

I would welcome a solution where the whole module width can be maximized and the alert text is truncated by a calculated value, if needed. But I don't want to articulate unrealistic demands, and we also got far away from the original subject, so I finish it right here. Thank you for your assistance again.