mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 18:48:22 +00:00
Fix base topic for 'topic' (#37475)
This commit is contained in:
parent
ddb049e884
commit
050a558243
@ -104,9 +104,9 @@ async def async_start(
|
|||||||
base = payload.pop(TOPIC_BASE)
|
base = payload.pop(TOPIC_BASE)
|
||||||
for key, value in payload.items():
|
for key, value in payload.items():
|
||||||
if isinstance(value, str) and value:
|
if isinstance(value, str) and value:
|
||||||
if value[0] == TOPIC_BASE and key.endswith("_topic"):
|
if value[0] == TOPIC_BASE and key.endswith("topic"):
|
||||||
payload[key] = f"{base}{value[1:]}"
|
payload[key] = f"{base}{value[1:]}"
|
||||||
if value[-1] == TOPIC_BASE and key.endswith("_topic"):
|
if value[-1] == TOPIC_BASE and key.endswith("topic"):
|
||||||
payload[key] = f"{value[:-1]}{base}"
|
payload[key] = f"{value[:-1]}{base}"
|
||||||
|
|
||||||
# If present, the node_id will be included in the discovered object id
|
# If present, the node_id will be included in the discovered object id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user