Hi,
I am in the process of writing a script to the MikroTik router platform to provide telemetry as MQTT.
This generally works as intended, and the entities created by through MQTT auto discovery are grouped as a device. I would however like the entities to also group with other relevant integrations interacting with the same devices.
An example of this is my Hue bridge, which shows not only the Hue integration, but also device tracker integrations from both MikroTik and Unifi:
As the device tracker integrations does not know anything about the devices other than possibly the MAC address, I assumed that posting the MAC addresses to the MQTT autodiscovery topic in the "ids"
array would do the trick, like this:
{
"~": "homeassistant/update/serial_number/RouterOS",
"name": "RouterOS",
"stat_t": "~/state",
"uniq_id": "serial_number_RouterOS",
"obj_id": "serial_number_RouterOS",
"dev": {
"ids": [
"serial number",
"92:b8:d5:bc:9d:39",
"22:c7:3a:80:78:ba"
],
"name": "chr",
"mdl": "CHR",
"sw": "7.11.2 (stable)",
"mf": "MikroTik",
"cu": "blabla"
}
}
But it does not work, as the entities are not grouped across integrations. Should I rather have put the MAC addresses in the "connection"
field of the JSON payload, which I am currently not using?
I have also considered removing the colons from the MAC addresses, if it makes a difference.
Is there any way to see which properties other entities expose to understand what these entities needs to expose to be grouped together? I have tied to dig around in the .storage
folder, mostly in core.device_registry
and core.entity_registry
to see if some clues were to be found, but I did not find anything that looked MAC addresses.
I did only add the MAC addresses to the entities later, so if it is necessary for the entries to be present initially, when the entities are added to Home Assistant this may also have been a problem.
The project itself is not quite ready for mainstream consumption, but if you want to take a look, it can be found here: GitHub - Xrlls/MikroTik-Home-Assistant-MQTT-telemetry
Any help on this is much appreciated!