When I run the code posted first as a service, I get Fehler beim Aufrufen des Diensts light/turn_on. expected int for dictionary value @ data['brightness']. However, this is an int, isn’t it?
When I use the code from above with brightness: 100 (instead of the template), it works fine. Using data_template instead of data does not work.
I was hoping to gradually lower the brightness whenever the cube sends action: rotate_left (and the other way round).
I tried all sorts of variants of this. But I thought target should work as it is provided be the service UI (when I create this via UI and then switch to yaml).
Oh damn! Yeah, that is how I was testing it. I will try writing the yaml as I believe it should work and save it. Perhaps that will work, will report later.
It works when put in an automation (well, turning up the brightness works perfectly; turning it down will always turn the lamp off alltogether, regardless of the current brightness).
The brightness_step parameter works so much better than my approach
Don’t forget that the root cause of the original problem was the use of templates in Developer Tools > Services. Should you ever need to template brightness_step, don’t forget you can’t test it in Developer Tools > Services.
Yes, I will definitely make sure to remember this next time I should have figured because !secret doesn’t work there, either (at least the last time I tried it), but I did so much in Home Assistant today that it must have slipped my mind… I got a README.me in my Home Assistant root folder and will link this topic to it!