We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3400163 commit 59123b7Copy full SHA for 59123b7
temperature_to_mqtt/temperature_sense_hat.py
@@ -2,6 +2,7 @@
2
from sense_hat import SenseHat
3
import socket
4
import time
5
+import uuid
6
7
sensor = SenseHat()
8
broker_address="10.1.0.1"
@@ -11,7 +12,8 @@ def get_ip_address():
11
12
s.connect(("8.8.8.8", 80))
13
return s.getsockname()[0]
14
-client = mqtt.Client("P1") #create new instance
15
+client_name = uuid.uuid4()
16
+client = mqtt.Client(str(client_name)) #create new instance
17
client.connect(broker_address) #connect to broker
18
ip = get_ip_address() # get current IP so we can ID ourselves
19
0 commit comments