MQTT Light/Fan not showing in device registry

I bought a Sonoff iFan03, and flashed it with Tasmota. I’ve been able to control the light/fan just fine from HA, but I’m unable to set the entities to a specific area - the device in the devices UI shows no associated entities. Any ideas on what might be preventing it from doing so?

Here’s a snippet from my configuration.yaml file:

fan:
  - platform: mqtt  
    unique_id: 13046501-fan
    name: "Bedroom Fan"  
    state_topic: "stat/bedroom_fan/RESULT"
    speed_state_topic: "stat/bedroom_fan/RESULT"
    state_value_template: >
        {% if value_json.FanSpeed is defined %}
          {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}2{%- endif %}
        {% else %}
          {% if states.fan.bedroom_ceiling_fan.state == 'off' -%}0{%- elif states.fan.bedroom_ceiling_fan.state == 'on' -%}2{%- endif %}
        {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/bedroom_fan/LWT
    payload_available: Online
    payload_not_available: Offline
    speed_command_topic: "cmnd/bedroom_fan/FanSpeed"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    command_topic: "cmnd/bedroom_fan/FanSpeed"
    payload_off: "0"
    payload_on: "2"
    qos: 1
    retain: false
    device: 
        identifiers: 13046501
        manufacturer: Tasmota
        model: Sonoff iFan03
        name: Fan
    speeds:
      - low
      - medium
      - high

light:
  - platform: mqtt
    unique_id: 13046501-light
    name: "Bedroom Light"
    state_topic: "tele/bedroom_fan/STATE"
    value_template: "{{ value_json.POWER1 }}"
    command_topic: "cmnd/bedroom_fan/POWER"
    availability_topic: "tele/bedroom_fan/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false
    device: 
        identifiers: 13046501
        manufacturer: Tasmota
        model: Sonoff iFan03
        name: Fan

Here’s what I see in the devices list for my device, though. Note that I have discovery enabled.

Also, if it helps, here’s what I see in Tasmota for MQTT configuration:

Devices manually created with yaml (as opposed to discovered devices) are not yet able to be added to areas. Work is being done on including them.

So be patient or use discovery.

As far as I can tell, discovery isn’t supported for fans, nor for combination devices like the iFan03.

If there’s an alternative here, I’m all ears.

EDIT: Spoke too soon - used the SetOption19 1 command to enable autodiscovery, and now have some devices in my registry. However, the format is quite wrong - I have a bunch of switches for each fan speed, which isn’t really ideal. Is there a way I could shoe-horn my custom configuration in to the discovery topic?

EDIT 2: I converted my snippet from the YAML file in to JSON, and manually published it to the discovery endpoint (with some minor modifications) - it worked great, until I rebooted HA. Is there a way to retain that configuration?

If you manually published a discovery message, you need to set the retain flag for it to be persistent across HA restarts.

1 Like

I’m kind of confused on what the big deal is to have entities listed as devices. Not just you but in general. There seems to be some confusion that if they aren’t listed as devices then you cant use them in automations.

You can do everything you might want to do using the fan entities (not devices) in your config. I have two iFan03’s and i dont use them as devices.

Why do you want them listed as devices? What are you missing if they aren’t?

Maybe I’m the one who is missing something.

I’m guessing it’s the ability to use the new “device” automation editor.

This worked great, thanks!

Not quite - I’m still doing automations based on entities. It’s more for forwarding to Google Assistant via HA Cloud - per their documentation, looks like devices get room hints based on the area assigned to them in HA. This requires they be in the device registry.

1 Like

And that was what I was wondering since there seems to be a growing misconception that if you don’t see your device in the device list then you can’t use any of the device in automations. Which obviously isn’t true.

That makes sense.

Would you mind sharing your script to publish the sonoff ifan3 to the discovery end point. I’m having some issues, probably a real simple syntax error.