Here is the config, I don’t save state and the light does not come on with the power, you have to turn the light on yourself, which is actually one of the reasons I replaced the original Hunter remote as that would always come on after a power outage. I have stuck with the relay configuration used by @mattcony above, but I did see this article that discusses a different relay sequence.
Great to see others are having success with the ifan04 – i just got mine and attempted to flash, but even with switching the RX/TX around and confirming the device is getting 3.3… i can’t get esphome to recognize the device locally.
I’ve tried both booting up while pressing the big white button, and booting up without pressing the white button. The later ends up with the device beeping at me consistently for some unknown reason … but the former is how i traditionally flashed sonoff’s, but esphome doesn’t recognize the ifan04…
wondering if i’m missing a step, or if there was a hardware revision i’m unaware of… any help would be appreciated
I too struggled initially to get the device into flash mode. I tried the ESPHome flashing tool for Windows and then Tasmotizer for windows tool. It was not until I was using Tasmotizer that I realized that my new ESP flashing device wanted RX to RX and TX to TX, I did not the go back and try the ESPHome flashing tool for Windows. It is a couple weeks since I did it, but I believe I might have held the button down for the entire flashing process. I used Tasmotizer to take a backup of the original firmware just in case
Any further information on the correct relay sequence? I have tested other fans without custom firmware and it seems that they toggle on more relays for low and medium speeds to help the blades start up. This thread discusses the issue on an iFan03 in tasmota, but I am not sure how that would translate to ESPHome. Something like this?
The article you linked gives a very good explanation of the Tasmota code. The complicating issue is that is seems like they also discuss the impact of capacitors in series, so without knowing the individual ratings of the capacitor associated with each relay and the Physics knowledge to correctly calculate I went with the existing settings of @mattcony. The fixed delay sounds like a good workaround until you consider the transition when the fan is already running. You only really want to enable the higher speeds at startup when the fan is not already turning. I will give tracking state some thought.
@devjklein: Here is a modified version that when the fan is off, will start the fan on high for 5 seconds then switch to the target speed. I also modified the relay sequence to speed 1 is relay 1 only, speed 2 is relay 2 only and speed 3 is relay 3 only.
fwiw - i’m up and running now too. I had a difficult time getting the device to burn properly. After initially not even being able to connect, my second issue was esphome would write the firmware, but it’d never start and connect to my wifi.
I found that starting with tasmotta, i was able to write the firmware and get on the wifi immidiately… tasmotta has an extra option that “erases” the device during firmware write. This seems to have resolved by issues.
I had a small secondary issue with not enough space to upload my esphome firmeware to the tasmotta burned device… until i backed down tasmotta to the “lite” / “minimal” version first… then i could swap over to my esp image no problem.
Just got around to uploading your code to my fan. It works great! I modified the start delay from 5 to 3 seconds, so it wouldn’t reach such a high speed on startup (fan is directly over seating, so max speed can be overwhelming )
I guess your fan starts spinning a lot faster than mine . Glad I could help, you provided the motivation to do something to improve the longevity of the iFan04-L device and the fan in this type of installation.
I did just notice an issue, if I start the fan from a stop with the remote, it operates as expected and toggles all relays on for a few seconds. However, if I set the fan speed in homeassistant, it appears the fan module bypasses the speed logic and goes directly to toggling on a single relay. Any thoughts on this?
The logic that is currently in the on_fan lambda needs to move to the output template. The on_fan handler is only used by the remote. I will think about how that needs to be reworked over the next few days.
@devjklein: Reworked so that the use of Home-Assistant utilizes the boost at startup as well when using the remote. I think there is a bug in the HA front-end, in that if you slide the fan speed to where you want and release it sends one set speed command and works perfectly, but if you tap the speed bar at a new speed level when the unit is off it will send the speed command twice as it powers the device on defeating the speed boost at startup.
@NigelHA Thank you for your work on this. I installed four ifan04 devices yesterday and they are working great in HA. My fans old remote control modules had a feature that I would like to check if it is possible to implement on the ifan04. When power to the fans is removed by using a wall switch or because of a power outage, the fans would remember and go back to their previous state when the power is restored. For example if a fan was running on medium when it lost power, it will start back at medium speed when the power is restored. Can that be done with the ifan04 and ESPHome?
if you want to check the code, it is in components/ifan
The next steps are to integrate ssieb’s ifan04, so that it’s all handled within the component code.
I can’t wait to try your code. Everything is working almost perfectly now, but I just noticed that my fan low and medium speeds are the same, so only low and high are really working.
I intentionally used lambdas to keep all the code together in the yaml file for easy manipulation, especially as the fan speed part of the configuration has been a point of contention for many on both the ifan03 and 04. But if you are going to submit this has an official component with speed issues addressed that would be great.