yyrkoon94 / lovelace-idf-mobilite

Lovelace Card for IDF Mobilité (Bus, Métro, RER)
24 stars 6 forks source link

Show TER trains in RER/SNCF lineType #12

Closed wgrs33 closed 11 months ago

wgrs33 commented 11 months ago

I added some modifications which will show also TER trains when using RER/SNCF lineType. If someone doesn't want to see them, train-ter must be added to exclude_lines.

yyrkoon94 commented 11 months ago

Hello,

Thanks for this improvement. Just an issue I think : all TER lines will be train-ter so if I want to exclude only one ter line I can't. Maybe we can use train-ter-(+line.name_line) so we can exclude specific TER line? Ok for the change on entity instead of entities (my first idea is to add a list of entities in the same card but finally I changed to have 2 entities max)

wgrs33 commented 11 months ago

That's a tricky thing with name_line, because all TER trains have something similar to TER Normandie or TER Hauts-de-France. If you use shortname_line then you have TER. I wanted to keep the same logic of choosing the images by checking what's behind the - in lineRef. Each TER have the same logo, so duplicating the content for each train doesn't make sens imo. It can be done as you want but I think that the JS logic should be changed a bit (I have some options in my head).

I forgot to comment the entity change. It could be another PR in fact. HA calls getCardSize() which crashes because entities variable is undefined. It is not visible, because HA handles it. What is visible on the other hand is that when you add more than one card, they won't be put it different columns (even if the screen is wide enough). That's a bug and this is the simple solution :)

yyrkoon94 commented 11 months ago

Ok let's go with this PR, we can also use the LineRef parameter to filter only the searched lines, so it's probably not a problem.