Google Maps Travel Time - input_select

Hi,

I am trying to make make a window in which I can choose origin, destination and travel mode to get an estimated travel time.

I have been able to do the following:

Input_select to make variables where I store the origin, destination and mode with a user friendly name.
Template sensors where I convert the user friendly name to a string that can be used with Google Maps Travel Time.

I have two issues:

  1. The sensors work fine with origin and destination. However, when I use the same method to try to set mode (under options) I get errors when checking the configuration:

Invalid config for [sensor.google_travel_time]: value is not allowed for dictionary value @ data[‘options’][‘mode’]. Got ‘sensor.resa_mode’. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.google_travel_time/

I do not understand why it does not work for mode when it works for origin and destination. Is there some other way that I can do this? Can the sensor.resa_mode be converted to a string?

The relevant code is:

In input_select.yaml:

  resa_mode:
    name: Resesätt
    options:
      - 'Bil'
      - 'Kollektivt'
      - 'Cykel'
      - 'Till fots'
    initial: 'Bil'

In sensors.yaml:

  - platform: template
    sensors:
      resa_mode:
        value_template: >
          {% if states.input_select.resa_mode.state == 'Bil' %}
              driving
            {% elif states.input_select.resa_mode.state == 'Till fots' %}
              walking
            {% elif states.input_select.resa_mode.state == 'Cykel' %}
              bicycling
            {% elif states.input_select.resa_mode.state == 'Kollektivt' %}
              transit
            {% endif %}

And finally also in sensors.yaml:

  - platform: google_travel_time
    name: Restid
    api_key: !secret google_travel_time_api
    origin: sensor.resa_start
    destination: sensor.resa_end
    options:
      mode: sensor.resa_mode

Solved 2. When I use the input select to change destination the input is changed and the corresponding sensor is changed, but the destination in the travel time sensor is not changed. A possible reason may be that it does not update due to the scan interval. Is there a way to force the travel time sensor to update if the state of the destination sensor is changed?

Any help is appreciated!

I found that there is a service command to update so issue 2 is resolved. Still need help with issue 1.

I’m confident that I personally will not be able to help you, but share your code!

I have edited my original post. Thanks

I tried the following without success:

  - platform: google_travel_time
    name: Restid
    api_key: !secret google_travel_time_api
    origin: sensor.resa_start
    destination: sensor.resa_end
    options:
      mode: {{ states("sensor.resa_mode") }}
    scan_interval: 1440

For some reason that manual update command does not work for me. Anyone else having this issue?
I checked the API dashboard and it doesn’t seem to receive the manual update requests.