Setting transition from input_number does not work

Hi!

I have an automation where I set the transition from an input_number. The Service data looks like the following:

{
  "brightness": 150,
  "color_temp": 366,
  "entity_id": "light.bar_back",
  "transition": "{{ states('input_number.bedroom_wakeup_duration') }}"
}

On executing the automation I get the following error:

Error while executing automation automation.test. Invalid data for call_service at pos 2: expected float for dictionary value @ data['transition']

I played around with setting transition time came to now result. What I’m missing here?

Have you checked that you get a float from your double bracketed text?

tried it with "{{ states('input_number.bedroom_wakeup_duration') | float }}" but also with no luck. Same error message.

Please show your automation. My guess is you’re using data instead of data_template.

You can’t use templates in service call dev page. Only static values.

{
  "brightness": 150,
  "color_temp": 366,
  "entity_id": "light.bar_back",
  "transition": 10
}

Then as @pnbruckner said, when calling the service from an automation use data_template to define the templates.

@pnbruckner / @petro thank you! Using the data_template works :slight_smile: