mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-12 14:48:57 +00:00
Always set unique_id. https://github.com/Koenkk/zigbee2mqtt/pull/419 #668 #646
This commit is contained in:
@@ -454,11 +454,8 @@ class HomeAssistant {
|
||||
// Set unique names in cases this device produces multiple entities in homeassistant.
|
||||
payload.name = mapping[model].length > 1 ? `${friendlyName}_${config.object_id}` : friendlyName;
|
||||
|
||||
// Only set unique_id when user did not set a friendly_name yet,
|
||||
// see https://github.com/Koenkk/zigbee2mqtt/issues/138
|
||||
if (ieeeAddr === friendlyName) {
|
||||
payload.unique_id = `${ieeeAddr}_${config.object_id}_${settings.get().mqtt.base_topic}`;
|
||||
}
|
||||
// Set unique_id
|
||||
payload.unique_id = `${ieeeAddr}_${config.object_id}_${settings.get().mqtt.base_topic}`;
|
||||
|
||||
if (payload.command_topic) {
|
||||
payload.command_topic = `${settings.get().mqtt.base_topic}/${friendlyName}/`;
|
||||
|
||||
Reference in New Issue
Block a user