home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.28k stars 30.6k forks source link

Google Maps Travel Time - mode cannot take value #18323

Closed folrewef closed 5 years ago

folrewef commented 5 years ago

Home Assistant release with the issue:

Hass.io 0.81.6

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

Hass.io

Component/platform:

Google Maps Travel Time

Description of problem: I am trying to make it possible to choose origin, destination and mode via input_select. This works fine for origin and destination but not for mode. That makes it impose to use mode as a variable. The yaml used for origin and destination as exactly the same structure and it works perfectly.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant): in input_select.yaml

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

in sensor.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 %}

also in sensor.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
    scan_interval: 1440

Traceback (if applicable):

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/

Additional information: I have tried the same with the "travel_mode" with exactly the same result.

fabaff commented 5 years ago

There is no support for what you want to do. mode: only accepts "driving", "walking", "bicycling" or "transit".

fabaff commented 5 years ago

Please use the forum for feature requests if you want to pursue this.

folrewef commented 5 years ago

Thank you. Still learning my way around the community. 😊