From c63bdd5afe9e0e158c420c09732bcff1bc88f327 Mon Sep 17 00:00:00 2001 From: Michael Heinemann Date: Thu, 6 Jul 2017 23:47:30 +0200 Subject: [PATCH] Mqtt client_id fix for #8315 (#8366) This applies what was the intended fix in #8336. moves the fallback for setting client_id to the case when no mqtt config was provided at all. This should reflect the most common use case that fails. This commit is a workaround and should be reverted when hbmqtt is fixed to allow empty client_id again. --- homeassistant/components/mqtt/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 64e804d7715..f5a66412962 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -315,15 +315,14 @@ def async_setup(hass, config): client_cert = conf.get(CONF_CLIENT_CERT) tls_insecure = conf.get(CONF_TLS_INSECURE) protocol = conf[CONF_PROTOCOL] - - # hbmqtt requires a client id to be set. - if client_id is None: - client_id = 'home-assistant' elif broker_config: # If no broker passed in, auto config to internal server broker, port, username, password, certificate, protocol = broker_config # Embedded broker doesn't have some ssl variables client_key, client_cert, tls_insecure = None, None, None + # hbmqtt requires a client id to be set. + if client_id is None: + client_id = 'home-assistant' else: err = "Unable to start MQTT broker." if conf.get(CONF_EMBEDDED) is not None: