-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better value for state #27
Comments
@hille721 |
Imo this is still to much information for a state value. I would keep it completely simple and only put in the either the actual departure time (so incl delay) as a date time stamp (like For the problem you are describing it would be probably best to sort the departures by actual and not planned departure. |
I already solved the issue with the sorting. Currently it looks like this: Only the time or minutes is not enough, because you also have to know if it is a S4 or an U5 or a Bus as there could be more than one transportation_type. And I am pretty sure you also want to know if its the correct destination. I think I will make a kind of template-scripting, so that every one can decide what he want to see. Do you need something else / special ? |
But this is not required as you already provide the great card and further more everyone can easily template it themselves, e.g: Also do you really want to provide a state in German? What is if non German speaking HA enthusiasts wants to use it? And there are a lot in Munich I would guess :) What I need are the minutes till the next departure. Currently it's a bit hard, I hacked this together: {% set time_str = state_attr('sensor.garching', 'departures')[0].planned_departure %}
{% set date_str = states("sensor.date") %}
{% set datetime_str = date_str ~ " " ~ time_str %}
{% set planned_departure = strptime(datetime_str, '%Y-%m-%d %H:%M') | as_timestamp | timestamp_custom('%Y-%m-%d %H:%M:%S', true) %}
{% set current_time = now() | as_timestamp | timestamp_custom('%Y-%m-%d %H:%M:%S', true) %}
{% set minutes = ((as_timestamp(planned_departure) - as_timestamp(current_time)) / 60) | int %}
{% set minutes_plus_delay = minutes + state_attr('sensor.garching', 'departures')[0].delay %} Thus just using the state ( |
v2.2.0 BETA 1 is released https://github.com/Nisbo/another_mvg/releases/tag/v2.2.0.BETA.1 |
Hi @Nisbo,
great integration! Just switched to it and really like. But what I don't understand is this state value: "Please use the project lovelace card to show your stop: ..."
Why not simply using minutes to next departure as state, with that it could be e.g. also easily used by Voice Assistant.
The text was updated successfully, but these errors were encountered: