Trying to install fan with sonoff smart switch

Hi there,

I purchased two sonoff light switches to control a ceiling fan in my house. I flashed it with tasmota. My problem is I can’t seem to get it to work. The closest I got was connecting the neutral to the live wire which finally got the light to turn on but now the smart switch can’t control if it’s on or off. Is there something I’m doing wrong. If anyone is wondering what kind of fan I got it’s this one:

And in my house I have 120 VAC Neutral and Ground. And the sonoff I am using is this one.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

Flashed with tasmota. If anyone can draw me some sort of diagram or show me where I can get an idea of how to set this up that would be great. Thanks in advanced.

take a photo of the inside so we can see the wiring we mite be able to help more

Well for starters you are really using the wrong device for a fan. That Sonoff can only switch its output on and off so you will have no control over the speed other than using the pull cord on the fan itself (I would have chosen a fan without an inbuilt speed controller and done the speed control via a smart fan controller). Since you are using 2 Sonoffs and I assume trying to use one for the fan and one for the light you will need to simply wire each to the fan such that the output neutrals from the sonoffs are both connected to the neutral on the fan, one sonoff active goes to the fan active and the other sonoff active goes to the fans light connection. Be sure to connect earth to the fan also.

I ended up ordering one of these:

Would this be a better way of going? Also anyone have a guide to convert this to tasmota? Would it be the same setup as how I did this sonoff basic?

Much better, although since you got a fan with an inbuilt speed controller you will need to leave it set to max and simply control it via the iFan for best results / WAF.

Perfect! Thank you for that! I will record my results here once I get everything.

FYI I have 2 and speed control is a problem on 1, due to capacitors used, in iFan03. Best is a medium speed, even at Max pull chain. Some threads out there on replacing capacitors on iFan03 but once it was up I chose not to fuss further.

So I got the iFan03 on the weekend. I have to say its amazing! Works perfectly. I just have a few questions: I ended up turning on the auto discovery on it and used it that way to connect. What are the pros and cons to using it this way as opposed to just adding it manually to the configuration.yaml file?

Second question: I also went ahead and bought some D1 Minis with DHT11 to monitor temperature as I want my fan to turn on when the temperature reaches a certain spot. However, I notice the refresh rate between HA and Tasmota is really slow. Is there a way to speed it up?

Put ESPhome on the D1’s instead of Tasmota

In the tasmota console, enter

teleperiod 10

That will send an update every 10 seconds

Ok thanks guys. Yea I ended up “teleperiod 10” and it helped a lot. My only problem is it’s not that accurate. It was telling me my room was 27 degrees when clearly it wasn’t that hot. So I order a DHT22 to see if that helps. Should be here tomorrow and I will post my results. However, one other question I had was adding the iFan03 into HA. I want to do it through the configuration.yaml file so that I have more control over it. I’ve managed to get the fan working but I can’t get the light part. Can anyone tell me what I’m doing wrong. Here is my code:

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

hi, anybody having issues after the latest update of core with the fan implementation? After the update Lovelace dashboard says it cannot find my fan entities?

Thanks

@Jaco
see if this is your issue

Hi, thanks this fixed the issue! Much appreciated!