Change input_select based on input_slider

Hi guys,

I’m getting an error message:

16-09-21 08:23:12 homeassistant.core: Invalid service data for input_select.select_option: required key not provided @ data['option']. Got None
16-09-21 08:23:14 homeassistant.core: Invalid service data for input_select.select_option: required key not provided @ data['option']. Got None
16-09-21 08:23:15 homeassistant.core: Invalid service data for input_select.select_option: required key not provided @ data['option']. Got None

when I try to run the following automation:

  action:
    service: input_select.select_option
    entity_id: input_select.scene_living
    data_template:
      entity_id: >
        {% if is_state( "input_slider.switch_scene_living", "0.0" ) %}
          "Auto"
        {%-elif is_state( "input_slider.switch_scene_living", "1.0" ) %}
          "Romantic"
        {%-elif is_state( "input_slider.switch_scene_living", "2.0" ) %}
          "Dim"
        {%-elif is_state( "input_slider.switch_scene_living", "3.0" ) %}
          "empty"
        {%-elif is_state( "input_slider.switch_scene_living", "4.0" ) %}
          "Normal"
        {% endif %}

I’ve tried to change the value from input_slider to int (0), str(“0”) and as you can see it’s float now.

What am I doing wrong?

Thanks!

Hey,

did you actually read the error message? It is literally telling you what to do. You need “option” in your data block. You only have a entity_id in your data block. Did you try to replace “entity_id” with “option” (The second one in the data_template block not the first one)?

Cheers

Dude, thanks! I’m still getting used to YAML and keep blaming it for my own faults.

1 Like