Sonoff ifan02

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.

sure here is the mqtt message after changing speed to 2

here is the tele/state lines

{"Time":"2019-09-20T20:13:38","Uptime":"0T08:39:50","UptimeSec":31190,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"ON","FanSpeed":2,"Wifi":{"AP":1,"SSId":"HA","BSSId":"E4:F4:C6:02:01:BA","Channel":6,"RSSI":100,"LinkCount":1,"Downtime":"0T00:00:04"}}

I had an improvement I got it to register the fan speed changes but it puts everything as med or off here is the yaml turns out it was the quoted mqtt topics i had in it

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

The quotation marks shouldn’t make any difference. My config has the quotation marks and it works fine.

However I did find a couple of mistakes in your code.

Where did you get the code above? Did you copy it from somwhere other than the Tasmota website or any of the threads/posts I’ve made?

Here are the incorrect lines:

    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 %}

they should be:

    speed_state_topic: KCF2/stat/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.kitchen_ceiling_fan_2.state == 'off' -%}0{%- elif states.fan.kitchen_ceiling_fan_2.state == 'on' -%}4{%- endif %}
      {% endif %}

the state topic is wrong and the {% else %} {% if %}… portion is wrong.

Entity_id’s are never going to contain uppercase characters. and you missed “…state” at the end of the line.

I think I got it directly from one of your posts but i would have to go fine to tell you for sure