Template in automation action

Hi there,

I’m trying to do something the very similar to this example from the docs, but I can’t get it done.

I have an input_number (sorry, it’s a french one ^^)

And I want to use it in a simple automation to set my climate component temperature.

If I use the template development tool with this template : Test value is : {{ states('input_number.test_value') | float | default(15.0) }}, I get the correct value.

But when using it inside my automation action I get a weird behavior. When I use temperature: "{{ states('input_number.test_value') | float | default(15.0) }}" in the data field, as soon as I click the save button, it gets modified to temperature: '{{ states(''input_number.test_value'') | float | default(15.0) }}'

And when testing the automation, I get this error in the logs : expected float for dictionary value @ data['temperature'] telling me the value cannot be properly read from the automation configuration.

If I use a simple value in the data field : temperature: 15, everything is ok. And back in the template development tool, when I use the template I get when I click the save button : Test value is : '{{ states(''input_number.test_value'') | float | default(15.0) }}', I get this error : Error rendering template: TemplateSyntaxError: expected token ',', got 'input_number'.

So, there are 2 possibilities :

  • I’m doing it wrong
  • Home assistant is doing it wrong

I’m a total beginner in Home assistant so I can easily believe I’m doing this wrong way, but this example seems really simple and similar to the documentation, and I can’t figure out what I’m missing. However, if this is a bug, I’ll add an entry to the bug tracker.