First mqtt e2e stub

This commit is contained in:
2021-12-18 01:06:04 +01:00
parent 04d87ed25c
commit e35f6951a1
3 changed files with 14 additions and 4 deletions

View File

@@ -1,8 +1,17 @@
import paho.mqtt.client as mqtt
class Connector:
MQTT_HOST = "127.0.0.1"
MQTT_PORT = 1883
@classmethod
def __mqtt_pub(self, message):
# to be encoded
client = mqtt.Client()
client.connect(self.MQTT_HOST, self.MQTT_PORT)
client.publish("dcc/commands", payload=message)
client.disconnect()
print(message)
return True