WoJWoJ
1
I have a power strip that is manageable on a per-socket basis. I created autodiscovery MQTT switches for each of the sockets.
I currently see them as separate devices, each of them having one entity:
Since this is actually one device with six entities, I would prefer to group them together.
Is there a way to do that when using MQTT autodiscovery? (and group several MQTT switches)
nickrout
(Nick Rout)
2
It certainly can be done. Zigbee2mqtt does it. Here is a discovery topic. I suspect the secret sauce is in the device:
section.
{
"availability": [
{
"topic": "zigbee2mqtt/bridge/state"
}
],
"device": {
"identifiers": [
"zigbee2mqtt_0x00158d000236a237"
],
"manufacturer": "Xiaomi",
"model": "Aqara human body movement and illuminance sensor (RTCGQ11LM)",
"name": "Motion Stairs",
"sw_version": "Zigbee2MQTT 1.16.2"
},
"icon": "mdi:signal",
"json_attributes_topic": "zigbee2mqtt/Motion Stairs",
"name": "Motion Stairs linkquality",
"state_topic": "zigbee2mqtt/Motion Stairs",
"unique_id": "0x00158d000236a237_linkquality_zigbee2mqtt",
"unit_of_measurement": "lqi",
"value_template": "{{ value_json.linkquality }}",
"platform": "mqtt"
}
nickrout
(Nick Rout)
3
And here for example is another entity in the same device: Note that the device section is identical to the above entity
{
"availability": [
{
"topic": "zigbee2mqtt/bridge/state"
}
],
"device": {
"identifiers": [
"zigbee2mqtt_0x00158d000236a237"
],
"manufacturer": "Xiaomi",
"model": "Aqara human body movement and illuminance sensor (RTCGQ11LM)",
"name": "Motion Stairs",
"sw_version": "Zigbee2MQTT 1.16.2"
},
"device_class": "illuminance",
"json_attributes_topic": "zigbee2mqtt/Motion Stairs",
"name": "Motion Stairs illuminance",
"state_topic": "zigbee2mqtt/Motion Stairs",
"unique_id": "0x00158d000236a237_illuminance_zigbee2mqtt",
"unit_of_measurement": "lx",
"value_template": "{{ value_json.illuminance }}",
"platform": "mqtt"
}
WoJWoJ
4
Thanks @nickrout - having a common unique identifier in the device
section indeed groups the entities under one device.