FIX: fix test code

This commit is contained in:
이수준 2023-10-17 17:40:08 +09:00
parent 5304b586aa
commit ed2394fde0
3 changed files with 13 additions and 4 deletions

9
config.json Normal file
View File

@ -0,0 +1,9 @@
{
"topic": "performance",
"id": "sdt",
"password": "11223344",
"host": {
"address": "192.168.100.200",
"hostname": "sdt"
}
}

View File

@ -1 +0,0 @@
topic: performance

View File

@ -10,8 +10,9 @@ parser = argparse.ArgumentParser()
parser.add_argument('-config',help='')
args = parser.parse_args()
with open(f'/usr/local/sdt/app/{args.config}/config.yaml', encoding='UTF-8') as f:
yamlData = yaml.load(f, Loader=yaml.FullLoader)
with open(f'/usr/local/sdt/app/{args.config}/config.json', encoding='UTF-8') as f:
# with open(f'./config.json', encoding='UTF-8') as f:
jsonData = json.load(f)
mqttc = mqtt.Client() # puclisher 이름
@ -33,7 +34,7 @@ while True:
"dataType":"",
"data": dataList
})
mqttc.publish(f"/sdt-cloud/{yamlData['topic']}", datas) # topic, message
mqttc.publish(f"/sdt-cloud/{jsonData['topic']}", datas) # topic, message
time.sleep(2)