Compare commits

..

2 commits

Author SHA1 Message Date
d6e62544db mqtt_client.py: reorder imports 2025-09-27 01:58:40 +02:00
eafc71d4f2 mqtt_client.py: mqtt_autodiscovery: remove client arg 2025-09-27 01:55:12 +02:00
2 changed files with 5 additions and 4 deletions

View file

@ -1,9 +1,10 @@
#!/bin/python #!/bin/python
import time
import paho.mqtt.client as mqtt
import argparse import argparse
import json import json
import time
import paho.mqtt.client as mqtt
import mqtt_client import mqtt_client

View file

@ -16,7 +16,7 @@ class MqttClient:
self.mixer = Mixer(mixer_ip) self.mixer = Mixer(mixer_ip)
self.client = mqtt.Client(callback_api_version=mqtt.CallbackAPIVersion.VERSION2) self.client = mqtt.Client(callback_api_version=mqtt.CallbackAPIVersion.VERSION2)
def mqtt_autodiscovery(self, client): def mqtt_autodiscovery(self):
j = json.dumps( j = json.dumps(
{ {
"name": "Reset Settings", "name": "Reset Settings",
@ -33,7 +33,7 @@ class MqttClient:
} }
) )
self, client.publish(self.MQTT_DISCOVERY_TOPIC, payload=j, qos=0, retain=False) self.client.publish(self.MQTT_DISCOVERY_TOPIC, payload=j, qos=0, retain=False)
def on_connect(self, client, userdata, flags, reason_code, properties): def on_connect(self, client, userdata, flags, reason_code, properties):
print(f"Connected: {reason_code}") print(f"Connected: {reason_code}")