speeds
(string | list)(Optional)
List of speeds this fan is capable of running at. Valid entries are off, low, medium and high.
I’ve tuyu converted a fan with 6 speeds.
If there was a CONFIGURATION VARIABLE payload_speed_template, then it could be passed the speed, and parse it for the correct payload, handling any number of speeds.
Something like this:
I tried your method and it’s works as advertised
Do have this syncing back to the UI? I suppose a tasmota rule to publish this same 3,1 result might work?
@dgwynne had a pull request with a similar method with a speed_command_template. I’ve been speaking to him a bit lately as I find myself in the same boat and it’s working well for him.
I’ve tried to override the built in component as a custom_component without success but maybe that’s our best shot - a custom mqtt fan.
Ultimately it surprised a method similar to yours or David’s hasn’t already been implemented.
FTR I tried dropping fan.py into config/custom_components/mqtt/ with and without an empty init.py file. Others seemed to have done this more successfully.
mqtt could now be updated to support additional speeds as the fan entity model has changed to allow up to 100 speeds (previously only 3 were allowed) and preset modes.
I have been following the update of the fan entity model. I would love to see the MQTT fan getting support for percentage. For now through after this change auto discovery the speeds variable will still populate the speed list box other values than off, low, medium or high, but an error will follow if you select any of these. Since the speeds variable now is deprecated, we need to make use of the new percentage and preset_modes features in the MQTT context as well. A set_percentage_topic should be settable through the config topic to make auto discovery possible.
To replace the deprecated speeds variable we also need a way to set preset_modes to be configured through MQTT auto discovery as well.
The existing speed_state_topic and speed_value_template variables should be there in a way they can also help to report back the actual preset_mode or percentage and present the reported state using a template.