alexa_media_player: Duplicated entities when using Home-Assistant-Matter-Hub custom Add-on

Describe the bug/issue

I started to use the custom add-on Home-Assistant-Matter-Hub which creates a Matter Hub whereby HA devices can be controlled via Alexa without using the Alexa via Home Assistant Cloud via Nabu Casa or the manually created Amazon Alexa Smart Home Skill (very slick!)

The Alexa Media Player application has logic already to handle devices added via the official Alexa Integration when using Include devices connected via Echo.

I duplicated this issue here so it can be a combined effort to find a good solution!

Here an example of a debug logs from a switch device:

{
    "applianceId": "AAA_SonarCloudService_<void>",
    "endpointTypeId": "",
    "driverIdentity": {
        "namespace": "AAA",
        "identifier": "SonarCloudService"
    },
    "manufacturerName": "TestVendor",
    "friendlyDescription": "TestVendor smart device",
    "modelName": "",
    "deviceType": "",
    "version": "0",
    "friendlyName": "Camara",
    "friendlyNameModifiedAt": 1733084691197,
    "capabilitiesModifiedAt": 1733084691197,
    "ipAddress": "",
    "port": "",
    "entityId": "<void>",
    "applianceNetworkState": {
        "reachability": "REACHABLE",
        "lastSeenAt": 1733130114179,
        "createdAt": 1733084691197,
        "lastSeenDiscoverySessionId": {
            "value": "<void>"
        }
    },
    "tags": {
        "tagNameToValueSetMap": {}
    },
    "additionalApplianceDetails": {
        "additionalApplianceDetails": {}
    },
    "firmwareVersion": "0",
    "actions": [],
    "capabilities": [
        {
            "capabilityType": "AVSInterfaceCapability",
            "type": "AlexaInterface",
            "version": "3",
            "properties": {
                "supported": [
                    {
                        "name": "powerState"
                    }
                ],
                "proactivelyReported": true,
                "retrievable": true,
                "readOnly": false
            },
            "interfaceName": "Alexa.PowerController"
        },
        {
            "capabilityType": "AVSInterfaceCapability",
            "type": "AlexaInterface",
            "version": "3",
            "properties": {
                "supported": [
                    {
                        "name": "connectivity"
                    }
                ],
                "proactivelyReported": true,
                "retrievable": true,
                "readOnly": false
            },
            "interfaceName": "Alexa.EndpointHealth"
        }
    ],
    "applianceTypes": [
        "SMARTPLUG"
    ],
    "isEnabled": true,
    "aliases": [],
    "connectedVia": "Echo Comedor",
    "alexaDeviceIdentifierList": [],
    "applianceKey": "<void>",
    "identifiers": {},
    "applianceDriverIdentity": {
        "namespace": "AAA",
        "identifier": "SonarCloudService"
    },
    "ipaddress": "",
    "applianceLambdaControlled": true,
    "mergedApplianceIds": [
        "AAA_SonarCloudService_<void>"
    ]
}

Maybe an option to exclude a likst of manufacturers or any other specific key will be useful.

  1. Setup new matther hub using https://github.com/t0bst4r/home-assistant-matter-hub/
  2. Enable Include devices connected via Echo
  3. Duplicated instances will show up all over the place

Expected behavior

Screenshots

System details

  • Home Assistant version: latest
  • alexa_media version (from const.py or HA startup log): latest
  • alexapy version (from pip show alexapy in homeasssistant container or HA startup log): latest
  • Is Amazon 2FA/2SV enabled <!—We will not debug login issues if unanswered—> (y/n): y
  • Amazon Domain: es

Debug Logs (alexa_media & alexapy) Please provide logs.

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (1 by maintainers)

Commits related to this issue

Most upvoted comments

It is unfortunately not correct for a matter bridge to report the bridge’s vendor on bridged devices. The vendor information there is meant to be that of the bridged device, e.g. “Philips” for a Hue bulb, not that of the bridge. The bridge vendor is only meant to be set on its own device node.

@danielbrunt57’s idea of getting the ID of the bridge device (which would still have the t0bst4r vendor, and also detail that it is a matter hub if one wanted to filter those out more generically) and checking an appliance ID prefix seems like a more viable long-term approach on first glance…

Yes, I forgot to set the vendor details for every device. Instead I only set it for the bridge. I’ve changed that and will release it tomorrow.

@danielbrunt57 it works fine 💅

2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor, connectedVia: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] namespace: AAA, driverIdentity: None, deviceType: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor is_local? False
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor, connectedVia: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] namespace: AAA, driverIdentity: None, deviceType: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor is_local? False
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor, connectedVia: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] namespace: AAA, driverIdentity: None, deviceType: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor is_local? False
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor, connectedVia: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] namespace: AAA, driverIdentity: None, deviceType: None
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] alexa_entity: Camara, manufacturerName: TestVendor is_local? False
2024-12-05 17:24:19.175 DEBUG (MainThread) [custom_components.alexa_media.alexa_entity] Found unsupported device Camara

Unless a _LOGGER_debug statement has been modified to specifically print it out, the only place I think you’ll see it is in the multi-page, single log entry: 2024-12-04 03:29:08.552 DEBUG (MainThread) [alexapy.alexaapi] d****l@b******a: get_network_details response:

get_network_details.txt

That is in my alexaapi.py that logs that entry:

    @staticmethod
    @_catch_all_exceptions
    async def get_network_details(login: AlexaLogin) -> Optional[dict[str, Any]]:
        """Get the network of devices that Alexa is aware of. This is the same as calling get_guard_details().

        Args:
        login: (AlexaLogin): Successfully logged in AlexaLogin

        Returns json
        """
        network_detail = await AlexaAPI.get_guard_details(login)
        if login._debug:
            _LOGGER.debug(
                "%s: get_network_details response: %s",
                hide_email(login.email),
                network_detail,
            )
        return network_detail

I think I modified that to use login.debug to conditionally log the entry, which is this configuration flag:

image

As a user we can control the name of the hub that it shows as friendlyName, this can lead us to find a way to filter out by hub, but this needs a new logic that is still not in place right?

Correct! In addition to that, the user will need a way to somehow input that “skill” friendly name exclusion into AMP UI config. Currently, exclude_devices is the friendly name but only the friendly name of the device.

or at least a yaml on which we can specify any key and value to include/exclude.

FYI, AMP YAML Configuration has/is being deprecated and 5.0.0 now issues a warning to that effect. Alan failed to provide me with version numbers for the warning so my PR says v4.14.0 will eliminate it but he jumped from 4.13.8 to 5.0.0 on the latest merge/release! I’m not sure now which next version will totally ignore it but it definitely will be gone soon.