1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 05:12:21 +01:00

Correctly allow mqtt topics to be none so ESPHome does not sub/pub to them (#5213)

This commit is contained in:
Jesse Hills
2023-10-26 13:37:50 +13:00
committed by GitHub
parent 4774200f6b
commit 8b9a7608f0
4 changed files with 30 additions and 8 deletions

View File

@@ -1047,6 +1047,8 @@ def ipv4(value):
def _valid_topic(value):
"""Validate that this is a valid topic name/filter."""
if value is None: # Used to disable publishing and subscribing
return ""
if isinstance(value, dict):
raise Invalid("Can't use dictionary with topic")
value = string(value)