Do not show an empty component name on MQTT device subentries not as None if it is not set (#144792)

This commit is contained in:
Jan Bouwhuis 2025-05-16 10:26:00 +02:00 committed by Franck Nijhof
parent 139b48440f
commit c373fa9296
No known key found for this signature in database
GPG Key ID: AB33ADACE7101952

View File

@ -2063,7 +2063,7 @@ class MQTTSubentryFlowHandler(ConfigSubentryFlow):
entities = [
SelectOptionDict(
value=key,
label=f"{device_name} {component_data.get(CONF_NAME, '-')}"
label=f"{device_name} {component_data.get(CONF_NAME, '-') or '-'}"
f" ({component_data[CONF_PLATFORM]})",
)
for key, component_data in self._subentry_data["components"].items()
@ -2295,7 +2295,8 @@ class MQTTSubentryFlowHandler(ConfigSubentryFlow):
self._component_id = None
mqtt_device = self._subentry_data[CONF_DEVICE][CONF_NAME]
mqtt_items = ", ".join(
f"{mqtt_device} {component_data.get(CONF_NAME, '-')} ({component_data[CONF_PLATFORM]})"
f"{mqtt_device} {component_data.get(CONF_NAME, '-') or '-'} "
f"({component_data[CONF_PLATFORM]})"
for component_data in self._subentry_data["components"].values()
)
menu_options = [