Sonoff iFan02 - stodev-com-br/tasmota GitHub Wiki
The Sonoff iFan02 is supported in Tasmota from version 6.0.0b
Serial Flashing
Please see the Hardware Preparation page for general instructions.
Flashing using only a USB to serial converter will not work as the unit draws too much current as can be observed by a flashing blue led on the PCA and a lot of serial gibberish. As AC is not connected to Gnd I used the available power supply of the unit and connecting the USB to serial converter to J3 pins Gnd, Tx and Rx.
The button is not connected to GPIO0 so flashing the unit requires some extra work. I managed to flash the iFan02 by soldering a wire to TP16 (GPIO00) on the bottom of the PCA. Keep this wire connected to Gnd during the power-on or reset process (pressing the button) and the unit will be in firmware upgrade mode. If you've soldered the gpio0 connection don't forget to unsolder before booting normally.
Connect RX -> TX | 3.3 -> 3.3 | TX -> RX | GND -> GND and connect TP16 to GND (as used in the TTL).
Press and hold the button while connecting to power.
If you have an Arduino you may be able to flash without providing an additional power source. I have successfully flashed using an Arduino Duemilanove with the atmel chip pulled out (basically using it for FTDI and 3.3v power regulation). Rx on Arduino goes to Rx on iFan02, Tx to Tx (no crossover like with FTDI). I did not have to press the button, only to ground TP16 while initiating the flash in Arduino IDE. The Arduino provides enough power to flash, however it will not boot into Tasmota unless you plug in to external power (it boot loops after flashing is complete).
Additonal information
Functioning iFan02 in Tasmota WebUI
iFan02 PCA with TP16
Two users report the TP16 pad lifting after soldering a wire to ground as shown in picture. This renders it useless. It may be better to use a pogo pin contact, bare wire or solder and then epoxy/glue the wire in place, leaving it permanently.
Board Top Showing ESP8285
ESP8285 Pinout
Using hard wired push button switch attached to iFan02 GPIO to cycle speeds
If anyone wants to setup a single push button switch attached to the GPIO3 Serial + ground In that will cycle through the speeds and turn off - after setting it in the configuration (GPIO3 to 11 Switch3) the console code is:
rule1 on switch3#state do FanSpeed + endon
Alternate Power Supply Schematic
HomeAssistant MQTT Fan config
Credit to finity
- 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 states.fan.master_bedroom_fan.state == 'off' -%}0{%- elif states.fan.master_bedroom_fan.state == '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
speeds:
- 'off'
- low
- medium
- high
HomeAssistant MQTT switch config for fan light
- platform: mqtt
name: "Dining room fan light"
command_topic: "cmnd/sonoff_MBR_fan/power"
state_topic: "stat/sonoff_MBR_fan/POWER1"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
optimistic: false