stef1
(Stefan)
1
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?
poldim
2
Have you checked that you get a float from your double bracketed text?
stef1
(Stefan)
3
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
.
petro
(Petro)
5
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.
stef1
(Stefan)
6
@pnbruckner / @petro thank you! Using the data_template
works