linx5o commited on
Commit
1fc0933
·
1 Parent(s): 4f18e25
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -16,7 +16,6 @@ status = gr.Textbox()
16
  update_time = gr.Textbox()
17
 
18
  def create_client(host, port, username, password):
19
- print(host, port, username, password)
20
  client = mqtt.Client()
21
  client.username_pw_set(username, password)
22
  client.tls_set(tls_version=mqtt.ssl.PROTOCOL_TLS)
@@ -42,7 +41,11 @@ def get_data(serial):
42
  global client
43
  if client is None:
44
  client = create_client(HOST, PORT, USERNAME, PASSWORD)
45
- client.publish(f"bambu_a1_mini/request/{serial}", json.dumps("HI"))
 
 
 
 
46
  return
47
 
48
  with gr.Blocks() as blocks:
 
16
  update_time = gr.Textbox()
17
 
18
  def create_client(host, port, username, password):
 
19
  client = mqtt.Client()
20
  client.username_pw_set(username, password)
21
  client.tls_set(tls_version=mqtt.ssl.PROTOCOL_TLS)
 
41
  global client
42
  if client is None:
43
  client = create_client(HOST, PORT, USERNAME, PASSWORD)
44
+ request = f"bambu_a1_mini/request/{serial}"
45
+ response = f"bambu_a1_mini/response/{serial}"
46
+ client.subscribe(response)
47
+ print(request)
48
+ client.publish(request, json.dumps("HI"))
49
  return
50
 
51
  with gr.Blocks() as blocks: