Sonoff ifan02

I have my sonoff ifan02 and ifan03s being auto discovered in the mqtt integration but I can’t figure out how to use them if anyone could help me with the setup that would be great I am kind of lost as far as how to use it and integrate it into UI

You should have a three speed fan entity and a light entity for each device that is discovered.

You can add them to the front end (lovelace) just like any other entity you add to lovelace… Either thru yaml or thru the gui. THen you will have a standard on/off/speed selection drop down like most other fans.

or you can install my fan control row from HACS (or manually) and use that in conjunction with your fan entities.

ok i will try re adding them maybe i did something wrong when i set up the mqtt or the tasmota

ok I re activated the device so that HA could detect it but what i get in HA is 4 switches the one that says kitchen is all from the ceiling fan here is how it shoes in MQTT intergrations also


Did you make sure to select the correct module for the ifan02 in the tasmota configuration?

Otherwise, if that is correct I’m not what you can do other than delete the auto discovered entities and configure it manually via the instructions on the tasmota wiki.

I dont use discovery for most things but I do kind of recall another user discussing having a similar issue with the ifan03 in the support thread on the tasmota forum. If I remember correctly they had to do the manual configuration to fix it too.

The ifan02 may be the same way.

well that one is a ifan03 but my ifan02 does the same thing so I guess I will add it manually i was hoping to be able to use discovery just to make everything simpler. is there a way to delete the auto discovered items without deleting the whole intergration?

also just for reference I do have it setup as a ifan03 in tasmota

ok i am doing manual adds but am slightly confused it doesn’t matter whether I use the code on the tasmota page or your code on the lovelace all I get for fan is a single on off switch like a light? I am slightly confused as I was under the impression that HA would see a fan as multispeed since it knows it is a fan.

The normal way fans work in lovelace is that it gives you a single on/off toggle for each of the light and the fan.

If you click on the fan control toggle it opens a “more-info” pop up box. From there you can set the fan speed.

Or if you want to have all of the fan controls on one line with having to use the “more-info” box then use my fan control row custom component. You can install it thru HACS or manually. But HACS is easier and more fool-proof.

thanks i see that i was unaware of where the controls were now what is the HACS you speak of?

hate to ask but what is name of what I am looking for in HACS?

I found it and have it working now I am just trying to get ui to read the MQTT data as it isn’t reading states

when you manually configured the device what were the topics you used?

it reads the on and off of the fan even when i use the remote but it doesn’t register the levels yet it changes the speed if i click them

fan:
  - platform: mqtt  
    name: "Kitchen Ceiling Fan 2"
    command_topic: "KCF2/cmnd/FanSpeed"
    speed_command_topic: "KCF2/cmnd/FanSpeed"    
    state_topic: "KCF2/stat/RESULT"
    speed_state_topic: "KCF2/tele/STATE"
    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.Kitchen_Ceiling_Fan_2 == 'off' -%}0{%- elif states.fan.Kitchen_Ceiling_Fan_2.state == 'on' -%}4{%- endif %}
      {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: KCF2/tele/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

switch the topic order around. I’ve heard that the topics as used by HA in discovery swap the first two sections of the topics. Since you aren’t using discovery you need to use the standard Tasmota topics.

so try these:

command_topic: "cmnd/KCF2/FanSpeed"
speed_command_topic: "cmnd/KCF2/FanSpeed"    
state_topic: "stat/KCF2/RESULT"
speed_state_topic: "tele/KCF2/STATE"

but this is my topic format

12:48:30 MQT: KCF2/tele/STATE = {"Time":"2019-09-19T12:48:30","Uptime":"0T

maybe. maybe not.

I’m not sure where that log entry is coming from. I don’t know if that’s before or after it is (possibly) modified by HA.

I do know what the default topic format is from tasmota. and it is the way I posted above. And since yours isn’t working it can’t hurt to try it my way.

that is my log entry from the tasmota console as i have all my topics switched so the device name is first i did that way before I started using HA

Do you have any way to sniff the MQTT messages that are traveling around the network? Like MQTTFx or MQTT Explorer?

What I suggest is that when you switch the fan speed or state then see what the response is from the device including the topic and the payload.