Compare commits
2 commits
bde5e940c8
...
d6e62544db
Author | SHA1 | Date | |
---|---|---|---|
d6e62544db | |||
eafc71d4f2 |
2 changed files with 5 additions and 4 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue