iFan03 on ESPHome, working ! well...sort of

Hi everyone, I had been searching this forum on how to integrate an iFan03 with ESPHome to smarten up a legacy RF remote controlled fan. Found a few resources on using Tasmota, but none on ESP Home. Since I like to keep it simple and have a bunch of devices on ESPHome already, I tried a few things, and with help from several folks in this community I got it to work (for me).

What works : iFan03 is flashed with ESPHome and integrated in HA. The 3 relays are controlled by pins 14, 12 and 15 (low/medium/high) and the light by pin 9. The 3 relays and the light switch can be activated as separate entities in HA.

What does not work : I could not configure it as a fan entity. I have tried this approach proposed by @finity here. I was able to figure out which changes to make the the ifan02h file and the config file, but in the end could not get the right behavior from the buttons consistently (for instance, switching from medium to low setting worked every other press : first press no behavior, second press worked).

How I circumvented that : Node Red flows…

In hope this might help somebody, here is

  1. config in ESP Home
esphome:
  name: ifan03
  platform: ESP8266
  board: esp8285

wifi:
  ssid: "xxxxxxx"
  password: "xxxxxxx"

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

output:
  - platform: gpio
    pin: GPIO9
    id: light_output
    inverted: true

light:
  - platform: binary
    name: "iFan03 Light"
    output: light_output
    id: ifan03_light

switch:
  - platform: gpio
    pin: GPIO14
    name: "relay_1"
    id: fan_relay1
    
  - platform: gpio
    pin: GPIO12
    name: "relay_2"
    id: fan_relay2
    
  - platform: gpio
    pin: GPIO15
    name: "relay_3"
    id: fan_relay3

    
text_sensor:
  - platform: version
    name: Master Fan ESPHome Version
    
sensor:
  - platform: wifi_signal
    name: Master Fan WiFi Signal Strength
    update_interval: 60s
  1. NodeRed Flows

  1. Lovelace (using button card)

(yes, the fans are spinning when on :slight_smile: )

Thanks to @RomRider for his help on the code for the speed attribute and @HakaToph for his help with the hardware setup

Hope this helps someone in this wonderful community !

Did you try turning off the other two relay when turning on the first e.g.

  • platform: gpio
    pin: GPIO14
    id: fan_relay1
    on_turn_on:
    • switch.turn_off: fan_relay3
    • switch.turn_off: fan_relay2

Hello. Did UI buttons status changes when you control with RF?
Also have you applied on_turn_on action: as described by @accelle

I’ve flashed this on esphome and the on_turn_on works. However, I wasn’t able to make the RF work, I think I’m missing something in the config so I opted to use tasmota for now.

Exactly, my RF is not working either but it was never my intent to have dual control since we have a tablet with HA access mounted in the bedroom. Also, the speed is automated based on room temperature and presence detection and we rarely use the manual switch.

mviamin i followed your code for esp-home. i can see it it esp home and it online but the integration does not show up when i restart hassio. Any advice?? I have converted most of my device from tasmota to esp-home but this one does not want to show up.

Hi @Geoff_Green, have you added it through the Integrations menu ?
Configuration --> Integrations --> hit the “+” at the bottom right, select ESPHome, and use the device IP as the host. You can find the device IP from your router (recommend you use IP address reservation if you have not already), or you can find the IP in ESPHome by clicking on show logs.

Hope this helps ?

That’s got it. @mviamin Was waiting for it to automatic appear like my other Esp-home stuff. I have got fan working with the remote as well using the Sonnoff bridge. just got to get the button card into Lovelace to complete it. Is the Button card one from Hacs or complete custom one?

Great ! Funny because I never got the remote to work…my assumption has always been that flashing ESPHome code was over-writing any of the remote functionality built in the factory firmware…anyway, good that you had it working.

In order to operate the fan, I used the Button Card from HACS and combined several into a horizontal stack.

Looks like this :

The reason for the lock button is because the operation of the fan is automated based on temperature (i.e. certain thresholds launch the fan at different speeds or turn it off). The lock button disables that functionality and lets users (meaning my wife :)) operate the fan manually…

Will impliment buttons when i get home. Thanks for the info. For the remote i use the Sonoff bridge with esphom. I intercepted the signal from the remote and created sensor for each button in the bridge and used node red to controll the ifan03

1 Like

There is a relatively easy solution to get the remote working without anything other than esphome:

remote_receiver:
  pin: GPIO3
  dump: raw

This will give you the raw codes of your remote, which you can use as binary_sensors like this:

  
binary_sensor:
  - platform: remote_receiver
    name: "Ventilator Büro Fernbedienung Stufe 0"
    id: remote_0
    raw:
      code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 104, -103, 104, -104, 103, -104, 105, -102, 104, -725, 104, -311, 103, -518, 104, -933, 103, -104, 104, -725, 104, -932, 104, -207, 207, -519]
    on_release:
      then:
        - switch.turn_off: fan_relay1
        - switch.turn_off: fan_relay2
        - switch.turn_off: fan_relay3
  - platform: remote_receiver
    name: "Ventilator Büro Fernbedienung Stufe 1"
    id: remote_1
    raw:
      code: [-207, 104, -104, 103, -104, 104, -103, 207, -104, 104, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -726, 103, -312, 103, -518, 104, -933, 103, -104, 104, -725, 104, -103, 104, -726, 103, -104, 311, -518]
    on_release:
      then:
        - switch.turn_on: fan_relay1
  - platform: remote_receiver
    name: "Ventilator Büro Fernbedienung Stufe 2"
    id: remote_2
    raw:
      code: [-208, 103, -104, 104, -103, 104, -103, 208, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -104, 103, -726, 104, -310, 104, -518, 104, -933, 103, -104, 104, -725, 104, -207, 104, -622, 103, -416, 102, -415]
    on_release:
      then:
        - switch.turn_on: fan_relay2
  - platform: remote_receiver
    name: "Ventilator Büro Fernbedienung Stufe 3"
    id: remote_3
    raw:
      code: [-207, 104, -104, 103, -104, 104, -103, 208, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -104, 103, -726, 104, -311, 104, -518, 103, -934, 103, -103, 104, -726, 103, -104, 207, -622, 104, -103, 104, -207, 104, -415]
    on_release:
      then:
        - switch.turn_on: fan_relay3
  - platform: remote_receiver
    name: "Ventilator Büro Fernbedienung Licht"
    id: remote_light
    raw:
      code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 104, -103, 104, -103, 104, -104, 103, -104, 104, -725, 104, -311, 103, -518, 104, -933, 103, -104, 103, -726, 103, -311, 104, -518, 104, -207, 104, -103, 104, -414]
    on_release:
      then:
        - light.toggle: ifan03_light

1 Like