I’ve seen this reported elsewhere but cannot figure out how to solve this. I am trying to set a light’s brightness to a fraction of anothers…
This is the code I am trying to get working taken from a ‘turn light on’ automation action, which throws "malformed: expected float at dictionary value @data ‘brightness_pct’
This code returns a value with no decimles in a 1-100 range as normally is accepted by this input field. For example at the time of writing, when pasting this line into the templat editor in developer tools, I get 11
I am pretty sure you can’t use templates in a Device action. Device triggers/conditions/actions are for very simple use cases. If you switch to the visual editor you’ll see that the UI will not even allow you to enter any characters for brightness except for numbers. For more advanced cases, use a normal service call instead, and prefer entities over devices for more reliability (device IDs can change if the devices is removed and replaced).
This did the trick after some playing around. At first it did not seem to throw an error, it just would not save. I kept refreshing and the value would just be null. Eventually after changing to double " " it seemed to like that and will run the automation now. Thank you! And sorry for not trying that as a service.