From 5738b911d39bc59abd710267b18b620015f04414 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=B4=EC=88=98=EC=A4=80?= <june@june-2.local>
Date: Mon, 25 Sep 2023 10:20:46 +0900
Subject: [PATCH] FIX: fix test code
---
main.py | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/main.py b/main.py
index c30d319..20176f9 100644
--- a/main.py
+++ b/main.py
@@ -14,25 +14,26 @@ with open(f'/usr/local/sdt/app/{args.config}/config.yaml', encoding='UTF-8') as
yamlData = yaml.load(f, Loader=yaml.FullLoader)
-mqttc = mqtt.Client() # puclisher 이름
-mqttc.username_pw_set("sdt", "251327")
-mqttc.connect("13.209.39.139", 32259)
+# mqttc = mqtt.Client() # puclisher 이름
+# mqttc.username_pw_set("sdt", "251327")
+# mqttc.connect("13.209.39.139", 32259)
while True:
- dataList = []
- for n in range(10):
- data = {
- "timestamp": datetime.now().timestamp(),
- "data": [1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 4, 5, 6, 1],
- }
- dataList.append(data)
- time.sleep(0.1)
+ print(f"Config value: {yamlData['topic']}")
+ # dataList = []
+ # for n in range(10):
+ # data = {
+ # "timestamp": datetime.now().timestamp(),
+ # "data": [1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 4, 5, 6, 1],
+ # }
+ # dataList.append(data)
+ time.sleep(2)
- datas = json.dumps({
- "assetCode":"",
- "timestamp":0,
- "dataType":"",
- "data": dataList
- })
- mqttc.publish(f"/device-test/{yamlData['topic']}", datas) # topic, message
+ # datas = json.dumps({
+ # "assetCode":"",
+ # "timestamp":0,
+ # "dataType":"",
+ # "data": dataList
+ # })
+ # mqttc.publish(f"/device-test/{yamlData['topic']}", datas) # topic, message