Sonoff IFan02 (Tasmota) MQTT Fan

Nope. I looked and you edited the same one I did after me. It’s OK but probably ought to still give credit to @kbickar for coming up with the original config that I just modified a bit.

That’s the way I had it before you edited it.

Are you asking for help with the automation or is the last part just an FYI?

Just an FYI but I sure do appreciate the offer of help. I’m thinking to just have the automation detect the delta between temp and hum from top to bottom. I don’t even think it’ll require a “new” template sensor. I’ll cogitate on it for a while since I don’t use the bike indoor unless there is foul weather.

I’m also considering, and bear with me here, a pendant fan hooked to the light on the iFan02. One that hangs down and is directed right below. It’s kooky, I know, but the ceiling fan just doesn’t generate enough direct airflow, nor is it designed to.

@finity @jumblies
Do the .yaml examples you guys posted in the Tasmota wiki (also shown above) work without having to set up that custom 4-button card?
e.g. sending a “4” in the “on” command.

I was just thinking that if those examples do require the custom card then you might want to include info/links to that as well.

Would you guys mind if I added an example on the wiki using kbickar’s original .yaml with the state_value_template json-error-cleanup? I don’t want to step on any toes but feel that example should be readily available as well.

No. They don’t require the card. Iirc you’ll get a switch for fan and light but when you click on fan the entity will open allowing you to chose speed. Visit the thread on github and you can see some evolution as we worked it out.

You never have to ask about editing a wiki. Please do. Ha docs are sparse and always need updating


I have used the code form the tasmota wiki for my ifan but i only see one button. (see image)

  - platform: mqtt  
    name: "Master Bedroom Fan"
    command_topic: "cmnd/sonoff_MBR_fan/FanSpeed"
    speed_command_topic: "cmnd/sonoff_MBR_fan/FanSpeed"    
    state_topic: "stat/sonoff_MBR_fan/RESULT"
    speed_state_topic: "stat/sonoff_MBR_fan/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 == 'off' -%}0{%- elif == 'on' -%}4{%- endif %}
      {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/sonoff_MBR_fan/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
      - off
      - low
      - medium
      - high


In order to get the 4 buttons on the card you will have to do some extra configuration (the link to get to the relevant thread is up higher in this thread in a post by finity).

I just posted my configs for the iFan02 on the Tasmota > Home Assistant wiki. It includes all the sections that need configuring (I don’t use the 4 button customization). Hopefully you will have more luck after checking it out.


Hi mjoshd,

I seen the post above but how do I access those files when I am running hassio (docker)?

I don’t use the 4 button customization so I can’t speak to how it is configured. As for the files mentioned in my post on the wiki entry, they are in the /config directory and are in the same place where you added the config for the iFan02 already.
I use on HassOS (rPi3). If you are using another host OS then you can enable an addon (Configurator, Samba, IDE, etc.) that will let you access the files without having to dig through the host OS (make sure you secure it according to the docs).
If you need more help/information about editing .yaml files, check here:

was just about to ask about a lovelace card, but found this:

Thanks, could you guide me on how to set this up? Which file needs which config?
Automation and switches i get that, but the rest?

Kind regards

I got everything to work, except one thing - my off button does not turn blue when i turn off the fan and whatever speed was last stays blue instead. didn’t have much time to dig deeper, but if someone knows how to fix that, please let me know, so i don’t spent time troubleshooting it.

thank you!

I had the same problem at first.

See this to see how to fix it:

read from there down and you’ll see the conversation about it.

Does anyone know if the remote that comes with the IFan02 can be used after flashing to Tasmota? In order to make this “wife-approved” I need it to work with a standard remote as well.

i flashed and remote working perfectly after that. so - yes.

1 Like

I even forgot to pair the remote before flashing and I was worried that I screwed it up but it paired exactly as it should after I flashed it.

1 Like


hassio noob here, have several (7) ifan02’s running off hass, and they’re working great, even better now I have the automation setup to get their state upon restart of hass. Thanks to all in this thread and elsewhere!

I have the home assistant cloud service (subsription, not manual) running also, and am able to turn fans off (and fans lights on and off) via google assistant, but not able to turn any of them on. I have no idea where to start with customising home assistant cloud devices, the documentation is rather minimal!

So question is, does anyone have google assistant ability to turn fans on? If so, any pointers?



stupid me, just realised I have to ask google to set the fan speed to high/medium/low and it works.

still don’t get any controls on google home hub though, just a single on/off toggle where off works but on does nothing. In google assistant mobile app I get no controls at all.

How did you get it to flash?

I’m missing something obvious but I don’t know what.

I am powering it with the mains since the wiki says 3.3v wont cut it.

Is the boot order power, jump Tp16 to ground, plug in usb?

Any help as to what you did would be greatly appreciated as I’m not following the small amount of info on the wiki and am new to tasmota.


It’s jumper TP16 to ground, power on, connect USB.

You have to have TP16 jumpered at boot to get it into flash mode. And be very careful about using main power. Not only can you fry your computer if you manage to feed main power back to the computer thru USB but you can also kill yourself if you screw up.

How did you power it if not using main?

Also, are you pushing the button while jumping?

Is there any indication on the board that it’s ready to flash?