@PatrickHASS.io , the variable percentage is supposed to be passed over from this part of the template fan over to the script in the service. There are some slight differences in the way we wrote the yaml though I don’t think it should affect the way it passes on the value.
Looks like you have to debug the script slowly to make sure the value in percentage is passed on over to the script.
It’s very odd @PatrickHASS.io, I’m unable to reproduce your issue in my setup.
This is how I’ve written it in config and scripts yaml. Somehow the variable value in your case isn’t passed over to the script for some reason but as you said appears to be updating after the template fan sets the value.
Just a quick thank you for taking the time to do this, it has been incredibly useful. Have been struggling to get speed settings working for ages and finally got them right with your help. They really need better documentation against the template fan.
Did you succeed? I have the same problem. Fan Speed: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data[‘value’]
@chrislimk Thanks for the helpful guide. I tried to update it for my fan. It has one button that switches speeds in loop 1, 2, 3, 1… And added the ability to adjust the speed both up and down and skip speeds. It was hard, but here is the result:
Fan speed script:
This script receives the percentage value, compares with the old value, directs it to another script that sends the actual command and updates it in the old value input_number entity.
Very nice! I had a thought of doing that as an improvement to the basic sequential one but never got down to doing it. It was more habitual for me to increase the speed and leave it there before turning the fan off completely
If I have an RF fan. and each of my 6 buttons are their only script. Each controller a different speed. I already have the power button working on a diff card so I dont need that. my goal is just a slider for the 6 speeds. Do i need anything more than this in my config file?
I found all this incredibly complicated for what i would like to do. I have a 3 speed fan controlled by a sonoff 4channel in interlock mode (tasmota).
I was thinking if i used the examples above to control the fan from HA it would work but if i pressed the physical buttons on the sonoff it would not update the input select.
Could i make 2 automations, 1 to switch the sonoff based on the position of a 4 state input select. And an another automation that could set the input select when triggered by the physical buttons on the sonoff,
or would this give me some sort of infinite loop issue