FIX: fix test code

This commit is contained in:
이수준 2023-10-16 15:39:08 +09:00
parent af5d932441
commit 9ef21a24ce
1 changed files with 18 additions and 18 deletions

36
main.py
View File

@ -14,26 +14,26 @@ with open(f'/usr/local/sdt/app/{args.config}/config.yaml', encoding='UTF-8') as
yamlData = yaml.load(f, Loader=yaml.FullLoader) yamlData = yaml.load(f, Loader=yaml.FullLoader)
# mqttc = mqtt.Client() # puclisher 이름 mqttc = mqtt.Client() # puclisher 이름
# mqttc.username_pw_set("sdt", "251327") mqttc.username_pw_set("sdt", "251327")
# mqttc.connect("13.209.39.139", 32259) mqttc.connect("13.209.39.139", 32259)
# f = open(f'/usr/local/sdt/app/{args.config}/text.txt') # f = open(f'/usr/local/sdt/app/{args.config}/text.txt')
while True: while True:
print(f"Config value: {yamlData['topic']}", flush=True) # print(f"Config value: {yamlData['topic']}", flush=True)
# dataList = [] dataList = []
# for n in range(10): for n in range(10):
# data = { data = {
# "timestamp": datetime.now().timestamp(), "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], "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) dataList.append(data)
datas = json.dumps({
"assetCode":"",
"timestamp":0,
"dataType":"",
"data": dataList
})
mqttc.publish(f"/sdt-cloud/{yamlData['topic']}", datas) # topic, message
time.sleep(2) time.sleep(2)
# datas = json.dumps({
# "assetCode":"",
# "timestamp":0,
# "dataType":"",
# "data": dataList
# })
# mqttc.publish(f"/device-test/{yamlData['topic']}", datas) # topic, message