From 706dc6d1164a2879788e8951419fec7a63e15096 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 4 Dec 2019 15:58:58 +0100 Subject: [PATCH] Fix MQTT logs Int or String expected Python 3 (#898) Fixes https://github.com/esphome/issues/issues/850 --- esphome/mqtt.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/mqtt.py b/esphome/mqtt.py index 541f1983f7..77eb941363 100644 --- a/esphome/mqtt.py +++ b/esphome/mqtt.py @@ -67,7 +67,9 @@ def initialize(config, subscriptions, on_message, username, password, client_id) tls_version=tls_version, ciphers=None) try: - client.connect(str(config[CONF_MQTT][CONF_BROKER]), config[CONF_MQTT][CONF_PORT]) + host = str(config[CONF_MQTT][CONF_BROKER]) + port = int(config[CONF_MQTT][CONF_PORT]) + client.connect(host, port) except socket.error as err: raise EsphomeError("Cannot connect to MQTT broker: {}".format(err)) @@ -127,7 +129,7 @@ def clear_topic(config, topic, username=None, password=None, client_id=None): # From marvinroger/async-mqtt-client -> scripts/get-fingerprint/get-fingerprint.py def get_fingerprint(config): - addr = str(config[CONF_MQTT][CONF_BROKER]), config[CONF_MQTT][CONF_PORT] + addr = str(config[CONF_MQTT][CONF_BROKER]), int(config[CONF_MQTT][CONF_PORT]) _LOGGER.info("Getting fingerprint from %s:%s", addr[0], addr[1]) try: cert_pem = ssl.get_server_certificate(addr)