Hello!
I have my work schedule in google calendar with correct time and place, with some hass component i can read that and calculate actual driving time to that workplace.
This is how it looks now:
Im so close to be done, but before i can share my project with the community, i got stuck in a problem… It cannot calculate the time when the travel time more than 60mins.
So if the travel time is less than 60mins:
states.sensor.google_travel_time__driving.attributes.duration.split(" ")[0]
← means minutes
‘{{states.calendar.work.attributes.start_time.split(" “)[0]}} {{ ((as_timestamp(states.calendar.work.attributes.start_time) - states.sensor.google_travel_time__driving.attributes.duration.split(” “)[0] | int *60) | timestamp_utc).split(” ")[1]}}’
But if the traveltime exceeds 60mins, it needs this:
states.sensor.google_travel_time__driving.attributes.duration.split(" ")[0]
← means minutes
states.sensor.google_travel_time__driving.attributes.duration.split(" ")[2]
← means hours
‘{{states.calendar.work.attributes.start_time.split(" “)[0]}} {{ (((as_timestamp(states.calendar.work.attributes.start_time) - states.sensor.google_travel_time__driving.attributes.duration.split(” “)[0] | int *3600 + states.sensor.google_travel_time__driving.attributes.duration.split(” “)[2] | int *60 | int) | timestamp_utc).split(” “)[1].split(”:“)[0]) | int -1}}:{{ ((as_timestamp(states.calendar.work.attributes.start_time) - states.sensor.google_travel_time__driving.attributes.duration.split(” “)[0] | int *3600 + states.sensor.google_travel_time__driving.attributes.duration.split(” “)[2] | int *60 | int) | timestamp_utc).split(” “)[1].split(”:")[1]}}’
Its a lot of mumbojumbo i know… Is there anyone who know a sh*tton about templating?