Homekit fan exposes useless switches

Hi there

I have Xiaomi smart fans 3 at home and absolutely love them! they can be integrated via a HACS-addon GitHub - al-one/hass-xiaomi-miot: Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成 and are recognized as zhimi.fan.za5.

In HA they have the following entities:

the first entity is definied as a fan-entity, the indicator light as a light-entity and the physical lock as a switch-entity.

the issue
I expose them to Homekit, to be precise just the fan-entity. However Homekit somehow also sees two switches.

How can I just expose the fan-entity without having the switches in Homekit? I already disabled the light and switch-entity in HA, but Homekit still sees them. If I click on the switch in Homekit they dont match with either the indicator light or physical lock.

I found this thread Remove Fan mode from Homekit climate and also tried to modify the fan-entity via customize.yaml but it doesnt work.

fan.wohnzimmer_ventilator:
  supported_features: 8

I appreciate any help and can hopefully help others too

all the best

Andrew

Just don’t expose the other 2 switches. They are separate entities. Only expose the fan.

thanks for your input. actually I did that but I still got the switches in Homekit.

Bildschirmfoto 2023-04-13 um 15.09.27

I just noticed that the fan-entity has some sub-entities. Maybe its possible to tweak the fan-entity to not expose the switches to Homekit?

Not sure what you’re talking about with sub entities. No entity has ‘sub entities’. Devices are comprised of entities, but an entity_id points to a single entity on a device, not the whole device. Are you sure you’re reloading homekit properly? There is an entire process to it and if you don’t follow it, old items persist. All covered in the homekit docs.

I am aware that each entity points to a single entity on a device. for the fan I have the following entities:

fan.wohnzimmer_ventilator
light.zhimi_za5_b443_indicator_light
switch.zhimi_za5_b443_physical_control_locked

I only include fan.wohnzimmer_ventilator in the homekit-section in my config.yaml. the light and switch are now excluded:

homekit:

  - name: Homekit Bridge
    port: 21070
    filter:
      exclude_entities:
        - light.zhimi_za5_b443_indicator_light
        - switch.zhimi_za5_b443_physical_control_locked
      
      include_entities:
        - fan.wohnzimmer_ventilator

I reloaded the Homekit-integration in HA and read the docs HomeKit - Home Assistant

Homekit shows the fan with three entities

BUT if I click on each entity, they are all called fan.wohnzimmer_ventilator.



maybe it has something to do with the HACS-add on and the way it generates/interprets the fan-entity.

Encounter the same issue too, not sure why it looks good in HA but a mess in Homekit

I have opened an issue on github (homekit integration in HA) Homekit fan exposes useless switches · Issue #91503 · home-assistant/core · GitHub , at the moment I cant narrow it down if the issue is caused by HA or the HACS-addon.

I also opened an issue on the HACS-addon, Homekit shows usless switches · Issue #1098 · al-one/hass-xiaomi-miot · GitHub

I’ve created a template fan with 3 preset stages (using two Sonoff switches) and I also have a useless set of switches in HomeKit - so I think this is a HomeBridge issue. I doubt the integration of the switches in HA via HACS or official has an impact as HK should see the entity you expose.

EDIT: read the GitHub issue and I can confirm iOS 17 is still doing this. It’s correct that the switches represent the modes and they work as intended. The issue is they aren’t labelled in a useful way.

The problem has been known for 2 years, is simply due to the HomeKit addon, it does not hand over the device as an air purifier and therefore it is only individual switches. If you give the same device with a separate instance Homebridge to the IOS device, it will be displayed cleanly. Had already opened a case including pictures, somehow it doesn’t go on.

I ran into the same issue: a Winix air purifier (winix_fan_1) gets passed to HomeKit as 1 fan and 5 switches. The solution I come up with is to create a virtual fan (winix_fan_passthru_1) that controls just the fan speed of the underlying Winix air purifier. This will lead to a plain fan in HomeKit. You may want to tweak the speed_count to fit your needs.

Add to configuration.yaml:

# Virtual Winix fan (air purifier) template
fan:
  - platform: template
    fans:
      winix_fan_passthru_1:
        friendly_name: "Winix Air Purifier 1"
        value_template: "{{ states('fan.winix_fan_1') }}"
        percentage_template: "{{ state_attr('fan.winix_fan_1', 'percentage') }}"
        turn_on:
          service: fan.turn_on
          entity_id: fan.winix_fan_1
        turn_off:
          service: fan.turn_off
          entity_id: fan.winix_fan_1
        set_percentage:
          service: script.fan_set_speed
          data:
            percentage: "{{ percentage }}"
        speed_count: 4
        
script:
    fan_state_on:
      sequence:
        - condition: state
          entity_id: fan.winix_fan_1
          state: 'off'
        - service: homeassistant.turn_on
          data:
            entity_id: fan.winix_fan_1
      mode: single
    fan_set_speed:
      sequence:
        - service: script.fan_state_on
        - service: fan.set_percentage
          target:
            entity_id: fan.winix_fan_1
          data:
            percentage: "{{ percentage }}"
      mode: single
1 Like

Is there any update / new ways to solve this?

I’m currently running into this problem for all the Inovelli fan switches I just installed.