Homekit will not add Sonos mediaplayers

Today I decided to switch to the native Homekit integration. I used the following setup in configuration.yaml:

homekit:
  filter:
    include_entities:
      - media_player.badkamer
      - media_player.eetkamer
      - media_player.keuken
      - media_player.renee
      - media_player.speelkamer
      - media_player.zolder
      - media_player.tv_kamer
      - switch.sonoff_power
      - switch.sonoff2_power
      - input_boolean.rachio_switch_zone1
      - input_boolean.rachio_switch_zone2
      - input_boolean.rachio_switch_zone3
      - input_boolean.rachio_switch_zone4
      - input_boolean.rachio_switch_zone5
      - sensor.temp_badkamer_temperature
      - sensor.temp_tuin_temperature
      - sensor.family_room_thermostat_temperature
      - climate.family_room
      - sensor.plant_sensor_temperature
      - sensor.water_sensor_temperature

But the Sonos mediaplayers are not added.
In the old situation running on Homebridge the Sonos’ where shown as switches.

I noticed this error in the log file:

2018-06-26 00:58:44 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 240, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity_platform.py", line 318, in _async_add_entity
    msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.renee. Platform sonos does not generate unique IDs

Any help is welcome.

You need to add some more config for the media_player. See the example in the documentation https://www.home-assistant.io/components/homekit/ for more information.

1 Like

Thank you. That’s it. Don’t know how I overlooked that.
Everything works!

Thanks.

I tried to do this, but the sonos players do not appear. Do I need to do anything else for HomeKit to show them. Or do I need to disconnect the bridge and reconnect it?

Here is my setup in configuration.yaml (warning: beware of the indents, I guess copying the code will remove some spaces):

homekit:
  filter:
    include_entities:
      - media_player.badkamer
      - media_player.eetkamer
      - media_player.keuken
      - media_player.renee
      - media_player.speelkamer
      - media_player.zolder
     - media_player.tv_kamer
  entity_config:
    media_player.keuken:
      feature_list:
        - feature: play_pause
    media_player.badkamer:
      feature_list:
        - feature: play_pause
    media_player.eetkamer:
      feature_list:
        - feature: play_pause
    media_player.renee:
      feature_list:
        - feature: play_pause
    media_player.speelkamer:
      feature_list:
        - feature: play_pause
    media_player.zolder:
      feature_list:
        - feature: play_pause
    media_player.tv_kamer:
      feature_list:
        - feature: play_pause

With this setup, were you able to figure out how to set the volume level via Siri? My Sonos is visible as a switch doing this, but I can’t control the volume level by asking Siri to set a percentage (which should work if it thinks is a light).

2 Likes