23 lines
500 B
Python
23 lines
500 B
Python
import paho.mqtt.client as mqtt
|
|
import json
|
|
|
|
device_1 = {}
|
|
device_1["mac"] = "C4:7C:8D:67:2E:1C"
|
|
device_1["name"] = "Pflanze 1"
|
|
device_1["client"] = "test_client"
|
|
|
|
device_2 = {}
|
|
device_2["mac"] = "C4:7C:8D:67:2E:4A"
|
|
device_2["name"] = "Pflanze 2"
|
|
device_2["client"] = "test_client"
|
|
|
|
devices = {}
|
|
devices["devices"] = [device_1, device_2]
|
|
|
|
client = mqtt.Client()
|
|
|
|
client.connect("chimaera", 1883, 60)
|
|
|
|
client.publish("dev/mqtt-miflora/device-configuration", json.dumps(devices), qos=1, retain=True)
|
|
|