mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix support for base topic for empty values in MQTT discovery msg (#19501)
* Fix topic expansion for short strings * Lint
This commit is contained in:
parent
4a1da0b041
commit
edb7ec78f9
@ -196,7 +196,7 @@ async def async_start(hass: HomeAssistantType, discovery_topic, hass_config,
|
||||
if TOPIC_BASE in payload:
|
||||
base = payload[TOPIC_BASE]
|
||||
for key, value in payload.items():
|
||||
if isinstance(value, str):
|
||||
if isinstance(value, str) and value:
|
||||
if value[0] == TOPIC_BASE and key.endswith('_topic'):
|
||||
payload[key] = "{}{}".format(base, value[1:])
|
||||
if value[-1] == TOPIC_BASE and key.endswith('_topic'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user