Having issues excluding certain domains and globs

Here’s what I have set up in my configuration.yaml as it stands right now. So far I’m still seeing all of these entities showing up in HomeKit and can’t seem to figure out why. Any help?

homekit:
- filter:
    exclude_domains:
      - automation
      - device_tracker
    exclude_entity_globs:
      - switch.adaptive_lighting_*
      - sensor.matt*
      - sensor.*battery*
    exclude_entities:
      - sun.sun
      - zone.home
      - weather.home_3
      - weather.home
      - sensor.hacs
      - binary_sensor.hub_myq_gateway

I’m also not seeing any impact of exclude filters. I’ve tried a few different things and restarted HASS server several times. Each time I see the same actions in the debug log. There’s no indication filtering is happening. How can I troubleshoot further?

Didn’t help me, but I notice your “filter” line in YAML starts with a hyphen rather than indentation. That’s contrary to the documentation.

homekit:
- name: HASS Bridge YAML
  auto_start: false
  filter:
    exclude_entity_globs:
      - light.mil*
      - light.adu*
      - switch.adu*
      - switch.mil*
    exclude_entities:
      - fan.mbr_ceiling_fan_motor

A log entry for a device I want excluded:

2020-12-08 14:35:01 DEBUG (SyncWorker_3) [homeassistant.components.homekit.accessories] Add "switch.adu_closet_lights_on" as "Switch"
...

The dash enumerates the group, so if you had two dashed sections under homekit they would both be recognized as discrete and individual.

Then anything at the same indentation level, but underneath the dash is considered a “sibling” of that group. So in this case, I use filter but didn’t need to give it a name so that’s where I could start with the dash addition. Similarly, I could have put name underneath the filter and it should have recognized all the same.

Sorry to revive this but I am having the same issue. Did you ever find a solution?

Necroposting but this might help others with the same issue.

Could not exclude devices using yaml no matter what was tried. Found Home Assistant was following the UI config and not yaml even though the UI config was deleted before returning to yaml. Deleted the homekit bridge from config/.storage/core.config_entries, re-adding the bridge to homekit and I was again able to properly include and exclude entities.

I had the same issue and finally found a solution. The problem occurred because I had homekit configuration extracted as a separate file and included in the configuration.yaml:

homekit: !include homekit.yaml

When I moved the content of the homekit.yaml into the configuration.yaml directly - the filters started working.