Google travel time with Templating

Hello,

I have this witch is working just fine :

platform: google_travel_time
api_key: !secret google_travel_time_api_key
origin: zone.home
destination: zone.work
name: Travel time to work
options:
  arrival_time: '08:30:00'

but i do not work every week at the same time, so i tried this but i cannot get it to work

options:
  arrival_time: >
    {% if is_state('sensor.travail_today', 'Evening') %}
      '10:10:00'
    {% elif is_state('sensor.travail_today', 'Morning') %}
      '08:30:00'
    {%endif %}

my sensor “sensor.travail_today” can be either “Morning”, “Evening” or “” (if not a work day)

Can this actually work ? How ?
Thanks !

You could create multiple sensors (I assume - I don’t use the travel time component) and summarize them with a template sensor.

Yes i guess that would work, but with the request limit/day i do not want to make unnecessary requests to the Google API.

That would work for me if there was a way to enable/disable sensors…

I do not get how i was supposed to figure it out, but since someone found the solution, here it is :