Trying to create an ETA sensor

I am trying to create an ETA (Estimated Time of Arrival) template sensor, and I’m hoping for some direction.

I have a google maps api sensor that gives me the driving time in minutes between two device trackers and is called sensor.time_between. I’m almost there, but I am struggling with one final part.

My template looks like this:

{{ (as_timestamp(now()) + ((states("sensor.time_between")*60) | int )) | timestamp_local }}

This gives me, for example:
2019-03-22 22:17:33

I’m trying to figure out to work in an strftime function into the template above so that the result would instead be:
10:17

I would normally use the following to format if I was going to format now():
{{ now().strftime('%I:%M') }}

… but I cannot figure out how to work strftime(’%I:%M) into my template above without giving me errors. Can someone clue me in?

I don’t have a “sensor.time_between” but I just substituted a 10 for your sensor to represent 10 minutes in the sensor so I think this will work:

{{ (as_timestamp(now()) + ((states(“sensor.time_between”)*60) | int )) | timestamp_custom ("%H:%M") }}

the real time right now here is 22:52 and the result of the template is 23:02

1 Like

Ahhh yes! That worked perfectly! Thank you!

happy to help…:slightly_smiling_face:

1 Like