Uniquify the MQTT ClientID
...as it needs to be unique.
This commit is contained in:
parent
255a61f40b
commit
eae0539912
1 changed files with 4 additions and 2 deletions
|
@ -3,6 +3,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import paho.mqtt.client as paho
|
import paho.mqtt.client as paho
|
||||||
import miio
|
import miio
|
||||||
|
import socket
|
||||||
|
|
||||||
|
|
||||||
## Logging to con
|
## Logging to con
|
||||||
|
@ -124,8 +125,9 @@ ap = miio.airpurifier_miot.AirPurifierMiot(ip=miot_ip, token=miot_token)
|
||||||
|
|
||||||
|
|
||||||
## The MQTT Client object
|
## The MQTT Client object
|
||||||
mqttClient = paho.Client("airPurifierBridge")
|
mqtt_clientId = "apBridge_" + socket.gethostname() + "_" + configfile
|
||||||
log(1, "Connecting to MQTT broker " + mqtt_ip)
|
log(1, "Connecting to MQTT broker " + mqtt_ip + " as " + mqtt_clientId)
|
||||||
|
mqttClient = paho.Client(mqtt_clientId)
|
||||||
mqttClient.connect(mqtt_ip)
|
mqttClient.connect(mqtt_ip)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
Reference in a new issue