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.
This commit is contained in:
Michael Heinemann 2017-07-06 23:47:30 +02:00 committed by Paulus Schoutsen
parent 20a9899354
commit c63bdd5afe

View file

@ -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: