Lovelace Fan Control Entity Row

I have updated the github with a NOTE at the top of the fan package code.

@daphatty

I just updated to V92.1 and the fan control still works for me.

Are you still having problems?

Not sure yet. I wonā€™t be able to upgrade to 92.1 for a few days as Iā€™m out of town. Iā€™ll let you know as soon as I get back. I do appreciate you checking in though. Thank you.

FYI - I logged in remotely and added your fan controls to my config. Not sure what changed but it is now working on 0.92.0. I am at a loss.

Thatā€™s great to hear! :slightly_smiling_face:

is there a legit github repo for this?

iā€™m not sure what you mean by ā€œlegitā€ but here is the github page with the info required:

https://github.com/finity69x2/Home-Assistant/tree/master/www/lovelace

Yah, thatā€™s what I meant. Thatā€™s ā€œlegitā€. Thanks!

1 Like

Is it possible to use this fan buttons with ESPHome flashed sonoff ifan02

i havenā€™t gotten an iFan02 flashed with ESPHome yet so I canā€™t verify it but I donā€™t see why not. as long as it still provides the feedback for state on/off & speed then it should work.

I canā€™t seem to get the card to work after flashing my ifan02 from tasmota to esphome :confused: i can change speed via the card when the fan is already on. But when the fan is off I canā€™t turn it on via any of the speed buttons

Iā€™ve never tested the control with ESPHome yet so Iā€™m not sure how the controls integrate into HA.

Could you please post your ESPHome firmware code so I can flash a spare Ifan02 I have here so I can test it?

Of course! Working really well for me so can highly recommend it :slight_smile: Here are the files i used https://gist.github.com/quazzie/09ee3ef2c419ecbcf979a7410062481b

Found them in this thread on github
https://github.com/esphome/esphome-docs/pull/218

Thanks!

Iā€™ve never worked with ā€œincludes:ā€ in ESPHome.

Where do I put the ā€œifan02.hā€ file so that ESPHome can find it at compile time? Is it just in the same directory as the rest of the ESPHome yaml files?

Yes, just the same location as the other yaml files :slight_smile:

1 Like

I previously had your fan control setup and working great in HA to operate my RMPro controlled fans. However it has stopped working and I canā€™t figure out why. When I click the Low/Med/High/Off buttons the RMPro commands are no longer being sent, and I see this in the logā€¦

Error executing service <ServiceCall script.mbr_fan_on (c:340632438bc54f90b02d842067286a01)>
10:23 AM core.py (ERROR)

Script script.mbr_fan_set_speed already running.
10:23 AM components/script/init.py (WARNING)

Error executing service <ServiceCall script.mbr_fan_on (c:ce0c5dc0f04b4a40ad94deff24c741c8)>
10:23 AM core.py (ERROR)

Iā€™ve tried replacing the .js file and have gone through my config and it hasnā€™t been changed. Iā€™ve updated HA to 0.93.2 (from 0.91.x and 0.92.x) with no difference. Any ideas what could be going on please?

From the log it doesnā€™t sound like the entity component is the problem.

It looks like itā€™s problem with the script. The script isnā€™t technically part of that component. Itā€™s just provided as a reference to get a ā€œnon-smartā€ fan working with the component.

Can you run the script to turn the fan on or to set the speed (the ones referenced in the log errors) manually? If the scripts were working before then did you make a change that would cause them to no longer work?

Thanks you are correct. I ought to have done this to begin with, but I just re-added a fan with a fresh copy & paste of your code and it all works fine, so I must have broken some of my old code when doing something else.

I do have another couple of issues I was hoping you might be able to advise on?

Firstly if I leave the automations section intact each command is sent from the RMPro to the fan twice, which isnā€™t a problem when sending low/med/high speeds, but on turning off it results in the fan switching back on again since my fans use the same command for both on/off. Iā€™m guessing that the automations purpose is to revert the state of the switches in HA back to off after they are used, but is there a way I can prevent the commands from being re-sent? If I simply delete all of the automations then my fans do work better as the commands are only sent once and therefore the off function works, and the entity card itself in the UI reflects the correct state - however the HA backend still retains the incorrect state, so I imagine this is not a viable overall solution.

Additionally, Iā€™m trying to add physical smart buttons to be able to control the fans. I have Xiaomi buttons setup in HA and NodeRED. They have single-click, double-click, and long-hold functions. Iā€™ve set it so that pressing double-click can cycle through triggering each of the different scripts in sequence which is effective, however this obviously doesnā€™t update the aforementioned entity in HA, which Iā€™d like to keep all in synch. Do you happen to know if there is a more elegant way to accomplish this? Thank you

Iā€™m glad you got it mostly working.

just to clarify your problem thoā€¦

you are saying that your fan doesnā€™t use the speed selection switches to turn the fan on? That there is another fan switch that turns the fan both off and on?

so, the four switches you have are:

low
med
high
on/off

And that the on/off switch uses the exact same rf code to turn the fan both on and off as a toggle like it does for the light?

is that all correct?

Almostā€¦ the original RF remote has an on/off button and individual 1 - 5 speed buttons (though Iā€™ve just been using 1, 3 and 5).

The on/off button sends the same command and will toggle the fan state, automatically resuming the previous speed setting when switching on, like a light would do.

The individual speed buttons can be used to switch the fan on without needing to press the on/off button first, but cannot switch it off.

I want HA to make the RMPro send a single speed command to switch on, and a single on/off command to switch off. Your code unmodified but with the automations section excluded does this perfectly, but as soon as I put the automations back in each time I press a speed setting the signal is sent twice (signified by 2 ā€˜beepsā€™ from the receiver on the fan) which isnā€™t a problem as repeating the same speed command it is already operating at doesnā€™t change anything, however when switching off it sends the off command twice, which ultimately cycles it off and quickly back on again (again 2 ā€˜beepsā€™ from the receiver).