From 0fa52d0ce64b659a26e024f3b4538769109cfdc2 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Thu, 27 Sep 2018 16:34:11 +0200 Subject: [PATCH] Fix MQTT discovery enabled when discovery_retain in config (#131) --- esphomeyaml/components/mqtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphomeyaml/components/mqtt.py b/esphomeyaml/components/mqtt.py index f9064a1d11..b1a2c560d5 100644 --- a/esphomeyaml/components/mqtt.py +++ b/esphomeyaml/components/mqtt.py @@ -100,7 +100,7 @@ def to_code(config): mqtt = Pvariable(config[CONF_ID], rhs) if not config.get(CONF_DISCOVERY, True): add(mqtt.disable_discovery()) - if CONF_DISCOVERY_RETAIN in config or CONF_DISCOVERY_PREFIX in config: + elif CONF_DISCOVERY_RETAIN in config or CONF_DISCOVERY_PREFIX in config: discovery_retain = config.get(CONF_DISCOVERY_RETAIN, True) discovery_prefix = config.get(CONF_DISCOVERY_PREFIX, 'homeassistant') add(mqtt.set_discovery_info(discovery_prefix, discovery_retain))