diff --git a/Dockerfile b/Dockerfile index 42f38e1..fde1876 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM python:3.12-slim ADD . /code WORKDIR /code RUN pip install --root-user-action ignore -r requirements.txt diff --git a/mqtt2log.py b/mqtt2log.py index 9f4986a..3ced572 100755 --- a/mqtt2log.py +++ b/mqtt2log.py @@ -11,9 +11,9 @@ MQTT_PASSWORD = 'mqtt7355@' MQTT_TOPIC = 'shellies/events/rpc' MQTT_CLIENT_ID = 'MQTT_Logfile_Bridge' -def on_connect(client, userdata, flags, rc): +def on_connect(client, userdata, flags, reason_code, properties): """ The callback for when the client receives a CONNACK response from the server.""" - print('Connected with result code ' + str(rc)) + print('Connected with result code ' + reason_code) client.subscribe(MQTT_TOPIC) def _parse_mqtt_message(topic, payload): @@ -51,7 +51,7 @@ def on_message(client, userdata, msg): return def main(): - mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1,MQTT_CLIENT_ID) + mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2,MQTT_CLIENT_ID) mqtt_client.username_pw_set(MQTT_USER, MQTT_PASSWORD) mqtt_client.on_connect = on_connect mqtt_client.on_message = on_message