Skip to content

Commit

Permalink
paho compatibility fix, skip TLS if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Beine committed Sep 6, 2024
1 parent 81d828e commit c687bcc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions knx2mqtt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async def on_telegram_received(telegram):
eprint(traceback.format_exc())


def on_mqtt_connect(client, userdata, flags, rc):
def on_mqtt_connect(client, userdata, flags, reason_code, properties):
global daemon_args

for address in daemon_args.mqtt_subscribe:
Expand Down Expand Up @@ -178,7 +178,8 @@ def start_mqtt():
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
cert_reqs = verify_mode[daemon_args.mqtt_verify_mode] if daemon_args.mqtt_verify_mode in verify_mode else None
tls_version = tls_versions[daemon_args.mqtt_tls_version] if daemon_args.mqtt_tls_version in tls_versions else None
mqtt_client.tls_set(cert_reqs=cert_reqs, tls_version=tls_version)
if cert_reqs is not None and tls_version is not None:
mqtt_client.tls_set(cert_reqs=cert_reqs, tls_version=tls_version)
if daemon_args.verbose:
logging.basicConfig(level=logging.DEBUG)
mqtt_client.enable_logger()
Expand Down

0 comments on commit c687bcc

Please sign in to comment.