Hi, I’ve recently dipped a toe into using home assistant, and have set it up to control our RF fans, lights and blinds via a broadlink rm pro, and integrating the controls into apple home so they can also be controlled via Siri.
My fans are setup as switches as they send the same RF command for on/off, then I have scripts to execute the RF commands for the various fan speeds and to also ensure the state of the fan is displayed as on if the fan is started via one of the speed commands (otherwise on/off just resumed the last used speed).
I’ve seen a couple of examples of other people’s fan controls which look great, but I can’t figure out how to emulate them… is anybody able to point me in the right direction please?
Using a slider with 4 positions you could use the custom:slider-entity-row card and an automation triggered on the slider or switch to set the fan speed (templates involved if you dont want multiple automations). You could actually do this with the standard input_number component but you wouldn’t have the toggle switch to turn it off. Just slide the slider down to 0.
Use the custom:tiles-card to create the row of four buttons to call scripts to set the fan speed.
Do you wan to use the buttons or slider?
Do you need to have a toggle switch to turn it off if using the slider or are you happy just to slide it to 0 (this is the easiest solution)?
I have rf fans also(6 speed) and comes with a light. In my case for sending the rf commands I use openmqttgateway. As for the fans entities I use the template fan one with a combination of input_number and input_boolean for the state and some scripts that fire the mqtt command according to speed. I can post later on the template fan yaml so you get the idea and you can adapt it to your setup.
As for having a 6 speed fan displayed in Lovelace I use a custom card that’s being around the forum.
I actually just ended up converting over a basic fan I had set up in HA when I originally started using it A LONG time ago. It had just been a bank of four switches that I had set up automations for to toggle the broadlink switches back off after I changed the fan speeds. The fan is now converted to a proper “fan” in the HA sense of the word.
And with that to get my version of the fan card to work from that other thread I just had to make a change to pick up the “off” speed state. It wasn’t turning off and it was giving me an error.
I’m starting a new thread to split my config away from the other thread and it has a link to a package of fans to use as a template for anyone who wants to use it.
Could you please explain how you expanded the card to show the 6 numeric buttons instead of the low-med-high buttons, and how you changed the off button to a toggle?
I initially tried modifying your code but was unable to understand what the MQTT section does or how to change this for my broadlink.
Instead I’ve managed to implement the control as per the instructions by @finity and it works well with my broadlink commands, but when I try to add additional speed settings and change them to numeric values it all stops working.
If you follow the link above to the thread for my code there is a further link there to a fan_package.yaml that has an example of how to set up a RF controlled fan using a Broadlink RM Pro.
The code is pretty extensive to get it set up as a “fan” entity and to work with the Fan Control Entity Row but it’s doable.
Once you get your fan set up as a HA “fan” entity then making further changes to get it to work with more buttons is also possible.
AFAIK that is part of the fan entity itself. If there is a state topic or entity to fetch the state from, unless is optimistic. If I list the fan in an normal lovelace entity card it shows like this
Wondering if you could provide some advice for my Broadlink fans? I have two ceiling fans that are dumb but I can turn them on and off and set speeds using Broadlink but with no feedback. With the help of @tom_l, I created a template sensor that provides an off/on state based on the monitored power use by a Shelly PM1.
But then @swiftlyfalling suggested a fan template which I’d never heard of and I found your thread. I’m wondering if you can look at the code below and provide feedback on the fan template code required? It looks like your script is fine and I should be able to adapt that.