diff --git a/requirements.txt b/requirements.txt index 11edc0e..22577ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ docopt==0.6.2 requests==2.31.0 -paho-mqtt==1.6.1 +paho-mqtt==2.0.0 diff --git a/teslamate_mqtt2abrp.py b/teslamate_mqtt2abrp.py index 8c5e331..fa31e95 100644 --- a/teslamate_mqtt2abrp.py +++ b/teslamate_mqtt2abrp.py @@ -181,10 +181,10 @@ def niceNow(): logging.debug("Trying to connect to {}:{}".format(MQTTSERVER,MQTTPORT)) client.connect(MQTTSERVER, MQTTPORT) -def on_connect(client, userdata, flags, rc): # The callback for when the client connects to the broker +def on_connect(client, userdata, flags, reason_code, properties): # The callback for when the client connects to the broker # MQTT Error handling - logging.info("MQTT Connection returned result: {} Code {}.".format(mqtt.connack_string(rc),rc)) - if rc != 0: + logging.info("MQTT Connection returned result: {} Code {}.".format(mqtt.connack_string(reason_code),reason_code)) + if reason_code != 0: sys.exit("Could not connect") client.subscribe(f"teslamate/cars/{CARNUMBER}/#") if BASETOPIC is not None: client.publish(state_topic, payload="online", qos=2, retain=True)