mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-22 14:01:20 +00:00
Fix Home Assistant group discovery collision between different Zigbee2MQTT instances. https://github.com/Koenkk/zigbee2mqtt/issues/7918
This commit is contained in:
1 parent
0df8663c8b
commit
cd1a4573b1
2 files changed
+7
-4
No files matched your search
@@ -995,7 +995,10 @@ class HomeAssistant extends Extension {
|
||||
}
|
||||
|
||||
getDiscoveryTopic(config, resolvedEntity) {
|
||||
const key = resolvedEntity.type === 'device' ? resolvedEntity.device.ieeeAddr : resolvedEntity.group.groupID;
|
||||
const key = resolvedEntity.type === 'device' ?
|
||||
resolvedEntity.device.ieeeAddr :
|
||||
`${settings.get().mqtt.base_topic.split('')
|
||||
.map((s) => s.charCodeAt(0).toString()).join('')}_${resolvedEntity.group.groupID}`;
|
||||
return `${config.type}/${key}/${config.object_id}/config`;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('HomeAssistant extension', () => {
|
||||
};
|
||||
|
||||
expect(MQTT.publish).toHaveBeenCalledWith(
|
||||
'homeassistant/light/9/light/config',
|
||||
'homeassistant/light/1221051039810110150109113116116_9/light/config',
|
||||
stringify(payload),
|
||||
{ retain: true, qos: 0 },
|
||||
expect.any(Function),
|
||||
@@ -100,7 +100,7 @@ describe('HomeAssistant extension', () => {
|
||||
};
|
||||
|
||||
expect(MQTT.publish).toHaveBeenCalledWith(
|
||||
'homeassistant/switch/9/switch/config',
|
||||
'homeassistant/switch/1221051039810110150109113116116_9/switch/config',
|
||||
stringify(payload),
|
||||
{ retain: true, qos: 0 },
|
||||
expect.any(Function),
|
||||
@@ -1703,7 +1703,7 @@ describe('HomeAssistant extension', () => {
|
||||
};
|
||||
|
||||
expect(MQTT.publish).toHaveBeenCalledWith(
|
||||
'homeassistant/light/9/light/config',
|
||||
'homeassistant/light/1221051039810110150109113116116_9/light/config',
|
||||
stringify(payload),
|
||||
{ retain: true, qos: 0 },
|
||||
expect.any(Function),
|
||||
|
||||
Reference in new issue
Block a user