Sonoff IFan02 (Tasmota) MQTT Fan

I got two iFan2s and found time to flash them only now. It seems the remote is broken on one. Red LED not working. The other one works fine but the remote does not turn the fan or switches on or off. How did you “pair” the remote? I tried removing and reinstalling battery but it doesn’t seem to work. Without remote, this is a no go :pensive:

Hi, Just flashed two iFan2 modules with just power coming from FTDI232. GND, Rx, Tx and 3.3 just the usual way and GND to TP16 when plugging the USB in. That’s it. Did not need to increase the power. Worked well!

I have 2 ifan02 as well, the remote is completely useless, batteries died with in a few days, and there range was completely useless, reason why they brought out the ifan03 with 433mhz remote.
The best thing I did was flash Esphome.
Tasmota was unpredictable.
I have a Hue Remote as the wall switch, but not happy with it, may look at the IKEA remote, or if I finally get the HA Switch Plate done one day.

You are saying that you have a working iFan03 running ESPHome and the remote works as well?

If so, do you mind either providing the code you used or a link to it?

No I said I have ifan02.
If you want the code for that happy to provide.

Oops, my bad. I could have sworn i saw ifan03. :crazy_face:

Never mind… :slightly_smiling_face:

Edit: you said “brought”. I thought you said “bought”…

That’s too bad. Esphome on the ifan03 would be nice to have.

well if you don’t care about the 433mhz remote its practically the same except the relays are just moved around and relay 1 is inverted
ifan02 - ifan03
image image

Quick question! In your setup, do you have other lights for your room? How to you keep the power running to Sonoff all the time. My bedroom only has fan lights and I need wall switch control also. But turning the switch off will turnoff the Sonoff. Any ideas to get that setup working?
Thank you.

I’ve noticed since a bunch of home assistant updates and the notes in the latest release I might need to update my current code:

fan:
  - platform: mqtt
    name: "Master Bedroom Fan"
    state_topic: "stat/sonoff-fan-master/RESULT"
    speed_state_topic: "stat/sonoff-fan-master/RESULT"
    state_value_template: >
        {% if value_json.FanSpeed is defined %}
          {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}2{%- endif %}
        {% else %}
          {% if states.fan.master_bedroom_fan.state == 'off' -%}0{%- elif states.fan.master_bedroom_fan.state == 'on' -%}2{%- endif %}
        {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/sonoff-fan-master/LWT
    payload_available: Online
    payload_not_available: Offline
    speed_command_topic: "cmnd/sonoff-fan-master/FanSpeed"
#    payload_off_speed: "0"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    command_topic: "cmnd/sonoff-fan-master/FanSpeed"
    payload_off: "0"
    payload_on: "1"
    qos: 1
    retain: false
    speeds:
      - off
      - low
      - medium
      - high

Here is the write up https://www.home-assistant.io/blog/2020/02/05/release-105/

MQTT Fan - This fixes supported_features for an MQTT fan. Setting speed now requires only a speed command topic.

Before this change, only a speed state topic had to be set to support the setting of a speed. The speed state topic is not taken into account as it just decides if Home Assistant gets feedback for state and speed updates.

Likewise, setting oscillation now requires only an oscillation command topic. Before this change, only an oscillation state topic had to be set to support the setting of the oscillation. The oscillation state topic is not taken into account as it just decides if Home Assistant gets feedback for state and oscillation update.

(@springstan - #28680) (mqtt docs)

Yes I just put in 2 5mtr LED addressable on the ceiling and they both have around their beds as well. Both fans are in my kids rooms, no power switch on wall
I just have a Philips Hue Remote as the wall switch, the can also use Alexa or a 4 button 433mhz remote I setup to an RF Bridge. Also stuck a quick widget to toggle them on their phones through the Android app. Eventually I will put in a HA Switch plate.

1 Like

Hi All

If anyone is interested, This is my config for the sonnof iFan02 flashed with tasmota

There has been a few changes from when I first setup like POWER is now POWER1 and the TOPIC has changed in tasmota but anyway, below works perfect for me using the custom fan card installed via HACS

light:
- platform: mqtt
  name: "Bedroom1 Light"
  state_topic: "tele/bedroom1fan/STATE"
  value_template: "{{ value_json.POWER1 }}"
  command_topic: "cmnd/bedroom1fan/POWER1"
  availability_topic: "tele/bedroom1fan/LWT"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  retain: false

fan:
- platform: mqtt
  name: "Bedroom1 Fan"
  command_topic: "cmnd/bedroom1fan/FanSpeed"
  speed_command_topic: "cmnd/bedroom1fan/FanSpeed"
  state_topic: "stat/bedroom1fan/RESULT"
  speed_state_topic: "stat/bedroom1fan/RESULT"
  state_value_template: >
    {% if value_json.FanSpeed is defined %}
      {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}4{%- endif %}
    {% else %}
      {% if states.fan.bedroom1fan.state == 'off' -%}0{%- elif states.fan.bedroom1fan.state == 'on' -%}4{%- endif %}
    {% endif %}
  speed_value_template: "{{ value_json.FanSpeed }}"
  availability_topic: tele/bedroom1fan/LWT
  payload_off: "0"
  payload_on: "4"
  payload_low_speed: "1"
  payload_medium_speed: "2"
  payload_high_speed: "3"
  payload_available: Online
  payload_not_available: Offline
  speeds:
    - 'off'
    - 'low'
    - 'medium'
    - 'high'
1 Like

Thanks! :+1:t2:

I cant find the custom fan card in hacs i Know this is old post. I just updated 931 tasmota and it change from light to fan I know i can swap it back but don’t want to mix things up if i dont have to.

Which custom fan card are you referring to?

this one:

Has someone already converted their config to the new fan integration settings? There are some changes:

The 'payload_medium_speed' option near /config/fan.yaml:0 is deprecated, please remove it from your configuration
The 'speeds' option near /config/fan.yaml:0 is deprecated, please remove it from your configuration
The 'speed_command_topic' option near /config/fan.yaml:0 is deprecated, please remove it from your configuration
The 'speed_state_topic' option near /config/fan.yaml:0 is deprecated, please remove it from your configuration
The 'speed_value_template' option near /config/fan.yaml:0 is deprecated, please remove it from your configuration

Try this thread to see if it helps:

For anyone who wants the old speed list functionality reinstated…

I’ve requested that the old speed list options should be kept and I’ve had a suggestion from a dev that if a FR gets enough votes they would implement it.

Here is the FR. Please go there and vote it up.

It won’t need to be updated if that FR gets implemented.

1 Like

OR just delete all that and use the Tasmota HA integration and Tasmota 9.3+.
It just works… No YAML at all…
Then you don’t have to fix it all for Percentage fan speed.
Thanks @emontnemery !!

I do use @finity 's fan control entity rows, however. (There is one for percentage fan speed as well that works awesome.)

Thanks for the fantastic contributions to the community!!

1 Like

I could see using that for new installs but there are a lot of existing fans using older tasmota versions who would benefit from leaving the speed list as an option.

and yes I know I could update my iFan03 to use newer tasmota. But I just have a dislike for updating things like this if they still work. And it does if the speed list gets left in.

and there are still template fans out there that may still need speed lists to work more effectively especially with the voice assistants.

And since the HA core change would be dead simple to add them back because they haven’t been fully removed now is the time to ask for (and implement) this “change”.

but thanks for the support for my button control rows. :slightly_smiling_face:

That was a post from over a year ago so sure the projects and integrations have moved on and better then what was sujjected then, but at the time it worked well

I myself have moved on and my only devices left running tasmota are two iFan02 as I am testing a third with ESP-Home and shortly will move the other two

I also use other fan-control cards