dvejsada / PID_integration

Home Assistant custom component for PID (Prague) public transit departure boards API.
20 stars 2 forks source link

Custom data filtering #29

Open zdeseb opened 1 week ago

zdeseb commented 1 week ago

I am new in Home Assistant world so maybe I am missing something but I was unable to find a way how to filter data displayed by flex-table-card. And by filtering I mean for example filtering by trip_headsign.

What I want to achieve is to display trains departing from Praha-Smíchov but I am only interested in direction out of the city, not to Praha hl.n..

I had expected to be able to filter either in flex-table-card entities or somewhere in between PID integration and the dashboard but found nothing :-)

Am I missing something or is the only way to add a custom filtering feature to PID integration itself?

dvejsada commented 1 day ago

@zdeseb Apologies for not responding earlier. Did you manage to find the solution? In case of buses and trams, this is handled on the integration level due to the fact that different directions have different platforms. In case of trains, unfortunately, there is only 1 platform for both directions. So it cannot be handled in the integration level, but it has to be handled on the dashboard (card) level. I believe such filtering should be possible with flex-table-card, I will have a look over the weekend.

zdeseb commented 1 day ago

@dvejsada I hoped flex-table-card had such an possibility but haven't found any. Eventually I tried entity-filter combined with flex-table-card inside but there are some problems while rendering dashboard (it works fine while I am adding the card but after refreshing dashboard there is a JS error - didn't have time to investigate further).

My idea how to implement the feature into PID integration was to add new editable parameter (similar way user selects the stop but without the dropdown, just text box) when adding new device. This value would be optional containing some filter expression. Question is if it could be done in some flexible way, unfortunately Python is not my cup of tea.