Skip to content

Commit 4e0c8ac

Browse files
committed
update
1 parent 9c848c1 commit 4e0c8ac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

subscriber.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
1111
File: This script is MQTT Subscriber Client
1212
"""
13-
13+
import secrets
1414
import tkinter as tk
1515
from datetime import datetime
16+
from random import randint
17+
1618
import paho.mqtt.client as mqtt
1719

1820

@@ -70,7 +72,7 @@ def on_message(self, client, userdata, msg):
7072
self.on_message_count, self.publish_message_count))
7173

7274
def connect_start(self, name, broker, port, username, password):
73-
self.client = mqtt.Client()
75+
self.client = mqtt.Client("iothook_%s" % secrets.token_hex(11))
7476
self.client.on_disconnect = self.on_disconnect
7577
self.client.on_message = self.on_message
7678
self.client.on_connect = self.on_connect

0 commit comments

Comments
 (0)