#Urgent - Journey Progress Bar Chart

1 messages · Page 1 of 1 (latest)

indigo falcon
#

(Urgent but not of vital importance)
I want to monitor a train journey. I have an integration from the transit authority giving me the departure and arrival times in datetime format

I want a progress bar chart showing how far through the journey it is.
Basically the chart has
minimum value of sensor.departure_time
maximum value of sensor.arrival_time
current value of now()

Anyone know of a card/integration/template or anything that will allow me to do this?

(The project becomes irrelevant in 2 days but it will be nice if I can)

waxen totem
indigo falcon
indigo falcon
#

This seems workable, if a bit clunky

type: markdown
content: >
{% set graph_max=as_timestamp(states("sensor.arrival_at_destination")) %}     
{% set graph_min=as_timestamp(states("sensor.departure_from_origin")) %} 
{% set graph_span=graph_max-graph_min %}    
{% set graph_value=graph_max - as_timestamp(now().strftime('%Y-%m-%d %H:%M'))  %}    
{% set graph_percent=100-((graph_value/graph_span)*100 ) %}  
{% if graph_percent <= 0.1 %}
  {% set graph_percent=0.0 %}
{% endif %}

  <div> <table width=100% cellspacing=0 > <tr><td><img height=20ox width={{
  graph_percent }}%
  src="https://img.freepik.com/free-photo/water-drops-background_23-2148098971.jpg">
   </td></tr></table>

  </td><td cellspacing="0" border="0" cellpadding="0"> </tr> </table> </div>