From 51810620fbce3a1244a9da5df903509d3da4299e Mon Sep 17 00:00:00 2001 From: Hermann Kraus Date: Tue, 7 Feb 2017 10:13:00 +0100 Subject: [PATCH] Check for command topics when determinig the capabilities of an MQTT light. (#5770) Previous code used the state topic which is obviously wrong: - The state topic is already used to select optimistic mode. - A light with only the state topic but no command topic would still announce the capability. --- homeassistant/components/light/mqtt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/light/mqtt.py b/homeassistant/components/light/mqtt.py index 54fa6b30598..5f227af97b6 100644 --- a/homeassistant/components/light/mqtt.py +++ b/homeassistant/components/light/mqtt.py @@ -121,12 +121,12 @@ class MqttLight(Light): self._state = False self._supported_features = 0 self._supported_features |= ( - topic[CONF_RGB_STATE_TOPIC] is not None and SUPPORT_RGB_COLOR) + topic[CONF_RGB_COMMAND_TOPIC] is not None and SUPPORT_RGB_COLOR) self._supported_features |= ( - topic[CONF_BRIGHTNESS_STATE_TOPIC] is not None and + topic[CONF_BRIGHTNESS_COMMAND_TOPIC] is not None and SUPPORT_BRIGHTNESS) self._supported_features |= ( - topic[CONF_COLOR_TEMP_STATE_TOPIC] is not None and + topic[CONF_COLOR_TEMP_COMMAND_TOPIC] is not None and SUPPORT_COLOR_TEMP) for key, tpl in list(templates.items()):