Using an Input Select value to launch a script

I’m clearly being slow (and new to it)… but trying to build a Lovelace dropdown with all the climate entities, and a big ‘Boost’ button that will call a script based on the input_select value:

The script is currently:

service: evohome.set_zone_override
data:
  entity_id: 'climate.{{state.input_select.boost_input}}'
  setpoint: {{state.input_select.boost_temp}}
  duration:
    minutes: {{state.input_select.boost_duration}}

With input_select.boost_input = lounge, it should call climate.lounge, and so on, but it’s reporting ‘state’ as ‘undefined’.

All the input_select mentioned above are defined via the UI (and show the state I’m after in Developer Tools).

In which particular way am I missing the point?

Thanks!

Delimit these two templates with (single or double) quotes:

  setpoint: "{{state.input_select.boost_temp}}"
  duration:
    minutes: "{{state.input_select.boost_duration}}"

Thanks. It’s actually the climate.{{state.input_select.boost_input}} which is failing first, with 'Failed to call service script/climate_boost. Error rendering data template: UndefinedError: ‘state’ is undefined’.

Even if I fix the value other two data points, I get the same error…

service: evohome.set_zone_override
data:
  entity_id: "climate.{{states('input_select.boost_input')}}"
  setpoint: "{{states('input_select.boost_temp')}}"
  duration:
    minutes: "{{states('input_select.boost_duration')}}"

If you are not using 0.118.X, you may need to add the int filter to the templates.

That’s got it! Thank you so much - when you’re still flailing around, it’s really hard to know if you’ve got the totally wrong idea, or are missing various bits of obscure punctuation. Thanks again!

1 Like