Issue creating service in custom component : Referenced entities are missing or not currently available

Hi there,

I’m creating a custom component in order to handle a yamaha soundbar.

My component works great based on the media_player intehration but I need to create custom service in order to address specific button.

In order to do that I added a services.yaml file like that :

toggle_clear_voice:
  name: Toggle Clear voice
  description: Toggle clear voice option.
  target:
    entity:
      integration: yamaha_sr_c20a

In my media_player.py I have declared my new service like that :

def setup_platform(hass, config, add_devices, discovery_info=None):
  macAdress = config.get('mac_adress')
  pollingAuto = config.get('polling_auto')
  scan_interval = config.get('scan_interval')
  name = config.get(CONF_NAME)
  session = async_get_clientsession(hass)
  add_devices([YamahaDevice(name, hass, macAdress, pollingAuto)])

  platform = entity_platform.EntityPlatform(hass=hass, logger=_LOGGER, domain="mediaplayer", platform_name="yamaha_sr_c20a", platform=None, scan_interval=scan_interval, entity_namespace="mediaplayer")
  platform.async_register_entity_service(
    "async_toggle_clear_voice",
    {},
    "async_toggle_clear_voice",
  )

I created the method to handle this service as well :

async def async_toggle_clear_voice(self):
    """Sets clearVoice to true."""
    ble_connect = BleData(self, self.hass, self._macAdress)
    if device._attr_extra_state_attributes['is_clear_voice'] == False:
      await ble_connect.callDevice(["clearVoiceOn"])
    else:
      await ble_connect.callDevice(["clearVoiceOff"])

When i go to the develop tool for service I’m able to find my new service :

But I cannot select the entity_id so I switch to yaml mode :

When in I clicked on “Call the service” I don’t have error but when I go into the log I have this :

log

The entity exists in my home assistant instance :

So I don’t understand what I’m doing wrong.

Does anyone could help me on this please ?

Thanks !