Skip to content

Commit 59123b7

Browse files
committed
Make client name random UUID
1 parent 3400163 commit 59123b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

temperature_to_mqtt/temperature_sense_hat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from sense_hat import SenseHat
33
import socket
44
import time
5+
import uuid
56

67
sensor = SenseHat()
78
broker_address="10.1.0.1"
@@ -11,7 +12,8 @@ def get_ip_address():
1112
s.connect(("8.8.8.8", 80))
1213
return s.getsockname()[0]
1314

14-
client = mqtt.Client("P1") #create new instance
15+
client_name = uuid.uuid4()
16+
client = mqtt.Client(str(client_name)) #create new instance
1517
client.connect(broker_address) #connect to broker
1618
ip = get_ip_address() # get current IP so we can ID ourselves
1719

0 commit comments

Comments
 (0)