Sonoff iFan03 with Tasmota Configuration (using MQTT)

@Peter_West Can you share your final iFan03 config? I am trying to setup one too. Thanks.

This is mine, running latest Tasmota firmware and the official MQTT broker addon. I am using the single entity row in the lovelace UI.

fan:
  - platform: mqtt  
    name: "MBR Fan"
    command_topic: "cmnd/mbrfan/FanSpeed"
    speed_command_topic: "cmnd/mbrfan/FanSpeed"    
    state_topic: "stat/mbrfan/RESULT"
    speed_state_topic: "stat/mbrfan/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.mbr_fan.state == 'off' -%}0{%- elif states.fan.mbr_fan.state == 'on' -%}4{%- endif %}
      {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/mbrfan/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
  - platform: mqtt
    name: "MBR Fan Light"
    command_topic: "cmnd/mbrfan/power1"
    state_topic: "stat/mbrfan/POWER1"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

Thank you! that worked for me.

1 Like

I have configured the Ifan03 in HA. I would like to run the fan even slower than the low speed. Is that possible the change the RPM of the fan.

No, the fan speed is set by the electronics (capacitors) in the controller.

Oke, thanks

Why do you guys set FanSpeed to 4 for on? That doesn’t do anything for me?? When I replace 4 with 1 it does turn on (to low).

4
**qos**  : 0,  **retain**  : false,  **cmd**  : publish,  **dup**  : false,  **topic**  : cmnd/tasmota_8FAD22/FanSpeed,  **messageId**  : ,  **length**  : 31
{"FanSpeed":0}
**qos**  : 0,  **retain**  : false,  **cmd**  : publish,  **dup**  : false,  **topic**  : stat/tasmota_8FAD22/RESULT,  **messageId**  : ,  **length**  : 42

And don’t you guys have the problem that speed in HA isn’t set to off when off?

I am sorry to be a pain, as I’m still new to HASSIO.

Can you please guide me as to what MQTT parameters you used in the Tasmota ifan03 config ? I think you used:

Client-mbrfan
topic-mbrfan

Is there any other name options in Tasmota that I need to adjust to get the if03 working?

I have mqtt working for all my other devices, just having the same troubles of not turning off and same speed as everyone else with the default mqtt / tasmota options.

Apologies for the dumb question

Jason


Just make sure your tasmota mqtt full topic is “%prefix%/%topic%/”, sometimes it gets swapped and causes dramas

Thanks so much for sharing - I’ll have a crack over the weekend !

All sorted - thank you so much for your help !!

finity - you are a genius and your code helped a newbie get up and running - thank you !

Just wondering if your control row can be enlarged? I am trying to get the buttons to be bigger.

I tried using ‘icon_height: 60px’ but to no avail.

Any suggestions?

Thanks again !

Jason

Thanks!

Not yet. But I might be looking into it at some point. I’ve had one other person ask about that too already.

‘might’ is good enough for me…

Thank You again for the code and effort !

Thanks for the great info posted here - I got my iFan03 to work nicely. I had to modify the yaml slightly, as sending FanSpeed 4 doesn’t seem to do anything. I made the default on state is “1” (low) instead, by modifying:

payload_on: "4"

to

payload_on: "1"

(and then change the 4’s in state_value_template to 1’s)

I’m not sure why that wouldn’t have worked I haven’t changed my config since I originally installed Tasmota on my iFan03.

unless Tasmota has changed something in the way it sends the commands.

Do you have an MQTT sniffer application like MQTTFx or MQTTExplorer? if so you can watch the traffic for your ifan03 when it’s commanded to do things (on/off/speed changes) and see what it’s sending around when you run the Tasmota control console. And then see if it’s different when you control it with HA.

I subscribed to the MQTT server and looked at the messages being sent.
Default buttons discovered by HomeAssistant sent commands like POWER4 ON, but they didn’t work very well:

(POWER1 ON/OFF switched the light on and off fine)

Starting from off, it switches on OK (though with problems):

cmnd/tasmota_8F9DE6/POWER3 ON
tele/tasmota_8F9DE6/STATE {[redacted] “FanSpeed”:3 [redacted]}
cmnd/tasmota_8F9DE6/POWER4 ON
tele/tasmota_8F9DE6/STATE {[redacted] “FanSpeed”:3 [redacted]}
cmnd/tasmota_8F9DE6/POWER4 OFF
tele/tasmota_8F9DE6/STATE {[redacted] “FanSpeed”:3 [redacted]}
cmnd/tasmota_8F9DE6/POWER3 OFF
tele/tasmota_8F9DE6/STATE {[redacted] “FanSpeed”:3 [redacted]}

I had to turn it off using the Tasmota web gui
Trying again:

cmnd/tasmota_8F9DE6/POWER4 ON
tele/tasmota_8F9DE6/STATE {[redacted] “FanSpeed”:4 [redacted]}
cmnd/tasmota_8F9DE6/POWER4 OFF
tele/tasmota_8F9DE6/STATE {[redacted] “FanSpeed”:2 [redacted]}

Why did it go to 2? Maybe the POWER commands are the relays, and different combinations are needed to get low/medium/high? Anyway, it was too much trouble to figure out when I could just use FanSpeed (except for speed 4):

cmnd/tasmota_8F9DE6/FanSpeed 0
stat/tasmota_8F9DE6/RESULT {“FanSpeed”:0}
cmnd/tasmota_8F9DE6/FanSpeed 4
stat/tasmota_8F9DE6/RESULT {“FanSpeed”:0}
cmnd/tasmota_8F9DE6/FanSpeed 1
stat/tasmota_8F9DE6/RESULT {“FanSpeed”:1}
cmnd/tasmota_8F9DE6/FanSpeed 4
stat/tasmota_8F9DE6/RESULT {“FanSpeed”:1}

Well, isn’t that interesting…

I’ve been using the config with the “0” for “off” and “4” for “on” since I switched from the iFan02 to the iFan03 and it has always worked fine…the way I was using it

I made/modified an Fan Control Button Row for my old iFan02 and I never used the standard toggle switches to control my fans and only ever used my button row. And it worked fine like that.

I just tried to turn the iFan03 off & on using the old toggle switch and it didn’t work.

I had to end up changing the config template to use “on” & “off” for the payloads and in the state template. Now both the toggle and my button row work to turn it off and on.

Shameless plug incoming…

If you have tried using my fan control row you should look into it. It makes it so you don’t need to bring up the “more info” pop-up to change speeds.

Here is a link to a recent post I made about all of my button control rows:

But thanks for prompting me to look into this more closely. I’ve been giving out incorrect info for a while and had no idea I was.

Lastest HA update Release 2021.3.3 break the add “fan control entity row” add on.

I’m not sure how to fix this. Did you encountered this too?

Sorry, I’ve moved into a new house and just starting to re-integrate everything. I don’t have ceiling fans installed yet so I haven’t had this integration running. Anyone else running this break after the latest update?