Skip to content

Commit

Permalink
Humanized the missing MQTT log topic error message (esphome#7634)
Browse files Browse the repository at this point in the history
  • Loading branch information
solarkennedy authored Oct 22, 2024
1 parent a932ca2 commit 7c05438
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions esphome/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ def show_logs(config, topic=None, username=None, password=None, client_id=None):
elif CONF_MQTT in config:
conf = config[CONF_MQTT]
if CONF_LOG_TOPIC in conf:
if config[CONF_MQTT][CONF_LOG_TOPIC] is None:
_LOGGER.error("MQTT log topic set to null, can't start MQTT logs")
return 1
if CONF_TOPIC not in config[CONF_MQTT][CONF_LOG_TOPIC]:
_LOGGER.error("MQTT log topic not available, can't start MQTT logs")
return 1
topic = config[CONF_MQTT][CONF_LOG_TOPIC][CONF_TOPIC]
elif CONF_TOPIC_PREFIX in config[CONF_MQTT]:
topic = f"{config[CONF_MQTT][CONF_TOPIC_PREFIX]}/debug"
Expand Down

0 comments on commit 7c05438

Please sign in to comment.