diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index fc87971064e..97ba96f0207 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -1144,11 +1144,8 @@ class MqttEntity( ) elif (device_name := config[CONF_DEVICE][CONF_NAME]) == entity_name: self._attr_name = None - self._issue_key = ( - "entity_name_is_device_name_discovery" - if self._discovery - else "entity_name_is_device_name_yaml" - ) + if not self._discovery: + self._issue_key = "entity_name_is_device_name_yaml" _LOGGER.warning( "MQTT device name is equal to entity name in your config %s, " "this is not expected. Please correct your configuration. " @@ -1162,11 +1159,8 @@ class MqttEntity( if device_name[:1].isupper(): # Ensure a capital if the device name first char is a capital new_entity_name = new_entity_name[:1].upper() + new_entity_name[1:] - self._issue_key = ( - "entity_name_startswith_device_name_discovery" - if self._discovery - else "entity_name_startswith_device_name_yaml" - ) + if not self._discovery: + self._issue_key = "entity_name_startswith_device_name_yaml" _LOGGER.warning( "MQTT entity name starts with the device name in your config %s, " "this is not expected. Please correct your configuration. " diff --git a/homeassistant/components/mqtt/strings.json b/homeassistant/components/mqtt/strings.json index 516672c88ab..ae6033de5f9 100644 --- a/homeassistant/components/mqtt/strings.json +++ b/homeassistant/components/mqtt/strings.json @@ -15,14 +15,6 @@ "entity_name_startswith_device_name_yaml": { "title": "Manual configured MQTT entities with a name that starts with the device name", "description": "Some MQTT entities have an entity name that starts with the device name. This is not expected. To avoid a duplicate name the device name prefix is stripped off the entity name as a work-a-round. Please update your configuration and restart Home Assistant to fix this issue. \n\nList of affected entities:\n\n{config}" - }, - "entity_name_is_device_name_discovery": { - "title": "Discovered MQTT entities with a name that is equal to the device name", - "description": "Some MQTT entities have an entity name equal to the device name. This is not expected. The entity name is set to `null` as a work-a-round to avoid a duplicate name. Please inform the maintainer of the software application that supplies the affected entities to fix this issue.\n\nList of affected entities:\n\n{config}" - }, - "entity_name_startswith_device_name_discovery": { - "title": "Discovered entities with a name that starts with the device name", - "description": "Some MQTT entities have an entity name that starts with the device name. This is not expected. To avoid a duplicate name the device name prefix is stripped off the entity name as a work-a-round. Please inform the maintainer of the software application that supplies the affected entities to fix this issue. \n\nList of affected entities:\n\n{config}" } }, "config": {