Skip to content

Commit

Permalink
Merge fb77084 into 06d959e
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Sep 30, 2018
2 parents 06d959e + fb77084 commit a63cbdb
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions homeassistant/components/mqtt/__init__.py
Expand Up @@ -426,25 +426,22 @@ async def async_setup_entry(hass, entry):
keepalive = conf[CONF_KEEPALIVE]
username = conf.get(CONF_USERNAME)
password = conf.get(CONF_PASSWORD)
certificate = conf.get(CONF_CERTIFICATE)
client_key = conf.get(CONF_CLIENT_KEY)
client_cert = conf.get(CONF_CLIENT_CERT)
tls_insecure = conf.get(CONF_TLS_INSECURE)
protocol = conf[CONF_PROTOCOL]

# For cloudmqtt.com, secured connection, auto fill in certificate
if (conf.get(CONF_CERTIFICATE) is None and
19999 < conf[CONF_PORT] < 30000 and
conf[CONF_BROKER].endswith('.cloudmqtt.com')):
if (certificate is None and 19999 < conf[CONF_PORT] < 30000 and
broker.endswith('.cloudmqtt.com')):
certificate = os.path.join(
os.path.dirname(__file__), 'addtrustexternalcaroot.crt')

# When the certificate is set to auto, use bundled certs from requests
elif conf.get(CONF_CERTIFICATE) == 'auto':
elif certificate == 'auto':
certificate = requests.certs.where()

else:
certificate = None

if CONF_WILL_MESSAGE in conf:
will_message = Message(**conf[CONF_WILL_MESSAGE])
else:
Expand Down

0 comments on commit a63cbdb

Please sign in to comment.