Skip to content

Commit

Permalink
Merge pull request #95 from dvdgeisler/feature/fix-entity-naming
Browse files Browse the repository at this point in the history
Fix warning in HASS about MQTT entities having the same device id and entity id
  • Loading branch information
TheMrBooyah committed Aug 3, 2023
2 parents 3120b2f + 36482be commit 46f6976
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public static <D extends Device> String getDefaultName(final D device) {
.map(d->d.attributes)
.map(a->a.model)
.filter(n -> !n.isBlank())
.orElse(device.id));
// MQTT entities aren't allowed to have the same Device ID as Entity ID in HASS from version 2024.2.0
// As a fallback to not having a custom name set, we add 'dirigera_' in front of the device ID
.orElse(String.format("%s_%s", "dirigera_", device.id)));
}

public de.dvdgeisler.iot.dirigera.client.mqtt.hass.model.Device getDeviceConfig(final D device) {
Expand Down

0 comments on commit 46f6976

Please sign in to comment.