Skip to content
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

Get updated Data and define additional params for a Sensor #2

Open
mintiworld opened this issue Oct 8, 2024 · 3 comments
Open

Get updated Data and define additional params for a Sensor #2

mintiworld opened this issue Oct 8, 2024 · 3 comments

Comments

@mintiworld
Copy link

mintiworld commented Oct 8, 2024

Hello Jonas,

Thank you very much for this integration in Home assistant.
The basic option of creating a sensor for a stop, for example, works.
However, the following problems arise:

  1. the state of the sensor changes continuously. the associated attributes, which contain the relevant data (departure time, real-time data e.g. delay) of the stop.
  2. I am currently using a markdown card to display the sensor data. Here, however, I can only access the attributes, which do not change.
  3. Is it possible to set how many results are retrieved per query via the Trias interface or where can the parameters per stop be set (e.g. <NumberOfResults>3</NumberOfResults> )?

What solutions are there to the above questions?

@JonasJoKuJonas
Copy link
Owner

  1. When there is new data from the API the sensor changes the data and attributes
  2. can you give me you markdown code that is not working
  3. i can add a extra key to change the NumberOfResults for a stop or trip

@mintiworld
Copy link
Author

Hi,

  1. here is my code of the markdown card:
content: >-
  |||

  |-|-|

  |<font color='#800080'><ha-icon icon='mdi:bus-stop'/></font> | **{{
  states.sensor.kvv.attributes.departures[0].StopPointName
  }}** | &nbsp;

  ---

  | Linie | Ziel | Abfahrt | Verspätung |

  |-------|------|:-------:|-----------:|

  |{{
  states.sensor.kvv.attributes.departures[0].PublishedLineName
  }} |{{
  states.sensor.kvv.attributes.departures[0].DestinationText
  }} |{{
  as_timestamp(states.sensor.kvv.attributes.departures[0].TimetabledTime)
  | timestamp_custom("%H:%M")}} | {% set time_str =
  states.sensor.kvv.attributes.departures[0].CurrentDelay
  %} {% set time_parts = time_str.split(':') %} {% set hours = time_parts[0] |
  int %} {% set minutes = time_parts[1] | int %} {% set total_minutes = (hours *
  60) + minutes %} {{ total_minutes }} min|

I'm not sure if the timezone is correct or if i should convert the utc time?

It would be great if you could add an additional key for the number of results per stop or in general.
Especially, if you want build a timetable for the next stops.

Julien

@juergenschorb
Copy link

Are there any news about this request?

Jürgen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants