Skip to content

Feature Request: Publish MAC Address as Home Assistant Device Connection in MQTT Discovery #1681

Description

@kymograph

Is there an existing issue for this?

  • I have searched the existing open and closed issues

Is your feature request related to a problem? Please describe

When NetAlertX publishes devices to Home Assistant via MQTT Discovery, the generated discovery payload includes device identifiers but does not include a Home Assistant device connection based on the device MAC address.

Currently the MQTT discovery payload contains something similar to:

{
  "device": {
    "identifiers": ["<device_id>_sensor"],
    "manufacturer": "NetAlertX",
    "name": "<device_name>"
  }
}

The MAC address is available elsewhere in the payload and is already passed into the MQTT publisher (mac=device["devMac"]), but it is not exposed in the device.connections field.

As a result, Home Assistant cannot associate NetAlertX entities with the same physical device discovered by other integrations (e.g. FRITZ!Box Tools, UniFi, Router integrations, etc.), leading to duplicate devices in the Home Assistant device registry.

Describe the solution you'd like

Add the MAC address as a Home Assistant device connection in all MQTT discovery payloads:

{
  "device": {
    "identifiers": ["<device_id>_sensor"],
    "connections": [
      ["mac", "AA:BB:CC:DD:EE:FF"]
    ],
    "manufacturer": "NetAlertX",
    "name": "<device_name>"
  }
}

and similarly for device_tracker discovery messages.

Describe alternatives you've considered

If automatic publication is considered a breaking change, a configuration option could be introduced:

MQTT_INCLUDE_MAC_CONNECTION=true

enabled by default for new installations.

Anything else?

The MAC address is already available within the MQTT publisher code and would only need to be added to the generated Home Assistant discovery payload. This appears to be a relatively small change with potentially significant usability benefits for Home Assistant users running multiple network-discovery integrations.

See also: https://developers.home-assistant.io/docs/device_registry_index/

Am I willing to test this? 🧪

  • I will do my best to test this feature on the netlertx-dev image when requested within 48h and report bugs to help deliver a great user experience for everyone and not to break existing installations.

Can I help implement this? 👩‍💻👨‍💻

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature request ➕New feature or requestnext release/in dev image 🚀This is coming in the next release or was already released if the issue is Closed.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions