[SOLVED] iFan03 with Home Assistant and Homekit - Speed Presets as 5 switches

Hello everyone!
i have an issue lately with my ifan03 from sonoff and homekit integration in Home Assistant i have not been able to short out using the forum or any other resource out there.

I have my Office Ceiling Fan with the sonoff ifan03 integated with Home Assistant for almost 2 years now, using the AlexxIT/SonoffLAN integration, which is working ok, which creates an entity fan.office that is then included in the homekit integration.

preset_modes:
  - 'off'
  - low
  - medium
  - high
percentage: 33
percentage_step: 33.333333333333336
preset_mode: low
friendly_name: Office Ceiling Fan
supported_features: 9

Up until some point, i had only one entity in my homekit, that i could control the speed with a slider . With an update that i cannot pin point, my fan entity inside homekit has now 5 accessories, i.e 5 different switches to control the fan, that correspond to the preset modes + one that controls all of them.

Screenshot - Untitled - 2022-05-16 at 08.38.18

The first switch Ceiling Fan is a slider, which then if a slide it to 66% the low switch turns off and the medium switch turns on, and so on.

Does anyone had the same issue like i do? Is there a way to configure the homekit integration so that the presets of the fan are not switches?

2 Likes

Yea had same issue after recent update. Fan presets (low, medium, high) in Home Assistant is showing as separate switches in Homekit. Also the separate on off Switch too.

thanks for replying! did you have any luck figuring out which component creates this behaviour or a way to work around it?

Just hand pick the entities in HomeKit integration config which you want to be shown in your home app.

Thank you for replying @digitone, the problem is that for home assistant, the fan is a single entity with some functions included (fan.office) and this entity is included in my homekit config. However, Homekit translates this one entity to 5 grouped switches.

@nioakeim on that screenshot I’ve made ( it’s on the second page of the HomeKit integration ), when you open the Dropdown menu ( click on the entities that are added) , it should show all the entities from your fan and all other entities you can pick, considering you got 3 fans and 2 switches in your screenshot tells me that you’ve included every fan entity without handpicking which fan entities you want.

@digitone i am not sure exactly what you are writing about. Allow me to give some more information. I am probably missing something here.

i have only one fan entity in my hass setup. This is fan.office.

entity settings

Screenshot - Settings – Home Assistant - 2022-06-04 at 11.57.33

entity related tab

entity controls
Screenshot - Settings – Home Assistant - 2022-06-04 at 11.59.03

For my homekit integration i use yaml control file which does not include domain fan but only the entity fan.office. Below is my yaml file i am talking about

- name: Home Assistant Bridge
  port: 51827
  filter:
    include_domains:
      - light
      - switch
      - sensor
      - climate
    include_entities:
      - input_boolean.tv_livingroom_mute
      - input_boolean.tv_livingroom_pause
      - input_boolean.kullhaus_air_filter_status
      - media_player.tv_livingroom
      - fan.office
    exclude_entities:
      - sensor.sm_t830_battery_temperature
    include_entity_globs:
      - script.tv_*
      - binary_sensor.*_occupancy
      - sensor.*_illuminance
    exclude_entity_globs:
      - media_player.*
      - input_boolean.*
      - sensor.gw_home_local_*
      - binary_sensor.gw_home_local_*
      - switch.gw_home_local_*
      - sensors.switch_2_office_*
      - binary_sensors.switch_2_office_*
      - switch.switch_2_office_*
      - sensors.switch_3_livingroom_wifi_*
      - binary_sensors.switch_3_livingroom_wifi_*
      - switch.switch_3_livingroom_wifi_*
      - sensor.*_battery
      - switch.adguard_*

yet my homekit screen shows the below

From what i’ve learned so far, is that only one entity is exposed to homekit, however homekit detects 5 accessories that belong to that entity, and creates 5 switches. A general switch called “Ceiling Fan” which is a slider (what i only want for homekit), a “Ceiling Fan High” switch which is on/off type, and the same goes for “Low”, “Medium” and “off”.

What you have suggested, applies to this setup?

It doesn’t apply, now it makes sense what you’ve said, as I thought the whole time you got more fan entities. Have you tried this

Converting your switches to binary sensors maybe so HomeKit doesn’t pick them up as switches?

this is the integration i am using actually, but i haven’t find a way in the documentation that would convert the specific channels of the ifan03 into separate entities to exclude from homekit. Any advice on that would be very much appreciated.

I’m not sure how to actually do it, since I don’t have anything to test it with at the moment. Is there any code in your configuration.yaml that calls the fan switch platform? If there is you could try applying this logic and convert it completely to light ( so you get a slider) and then only add that new light in your HomeKit.

Follow the solution in this topic

So, @digitone i found the solution finally! I am documenting it here in case someone else gets baffled by this behaviour…

from the homekit manual, there was a mention that homekit understands the list of the speeds of the fan with an attribute called “speed_list” like the example below

speed_list = [ "off", "low", "medium", "high"]

but from the entity details i could only see

preset_modes:
  - 'off'
  - low
  - medium
  - high

at some point, the sonoff integration probably changed the speed_list to preset_modes and homekit started seeing presets as separate switches.

so i thought of adding the speedlist to my configuration > customize file

fan.office:
  speed_list: ["off", "low", "medium", "high"]

unfortunately this did not hide the separate presets from homekit, so i did experiment a bit and tried to empty the list of preset_modes by adding this to my customize config

fan.office:
  preset_modes: []

This removed all the additional switches from homekit and i am back to normal. The only downside with which i am ok with, is that i do not have the preset list from the homeassistant UI.

Side Note:
for those that do not know or have a customize file, the way i have it in my setup is to add to my configuration.yaml file the following snippet

homeassistant:
  customize: !include customize.yaml

and then i created the file customize.yaml file to the config directory adding the below config

fan.office:
  preset_modes: []
3 Likes

Hey, I have an identical problem - could you show me your configuration file?

1 Like

I also have a template fan with Sonoff Lan intgerated switches. I understand from another thread that this is a Homekit bug since iOS16 (it is still the same in the latest 17 per date of this post). Good to know that the preset-caused switches can be removed from HomeKit, but I like to have usable preset modes in HK I can use with Siri. HAs anyone figured out how to convince Homekit that the presets should be represented differently and (or at least) with useful labels?

1 Like

I too have this problem with my CBUS Fans.

Whilst I’ve added the speed list to my config as per SOLVE of solution (which gives me a controllable speed slider on one button in Homekit),

I cannot find a way to exclude attribute in entity for homekit filter nor can you add a configuration of “preset_modes: ” to entity under entity_config that I can see.

You can manually ‘remove from home view’ each attribute button related to “preset_modes” in homekit once you’ve separated into single tiles (show as separate tiles) leaving you with the speed list capable fan button.

This leaves you with HA UI and preset modes as well as homekit with speed controllable slider with preset speeds

Does this still work? I’ve added teh speed_list setting to my customize.yaml but the fan still isn’t showing up correctly in HK.

I just tested this with one of my fans and it works, I never actually used the presets so I’m fine with it.