diff --git a/config.json b/config.json new file mode 100644 index 0000000..f77c7a2 --- /dev/null +++ b/config.json @@ -0,0 +1,9 @@ +{ + "topic": "performance", + "id": "sdt", + "password": "11223344", + "host": { + "address": "192.168.100.200", + "hostname": "sdt" + } +} \ No newline at end of file diff --git a/config.yaml b/config.yaml deleted file mode 100644 index b932adb..0000000 --- a/config.yaml +++ /dev/null @@ -1 +0,0 @@ -topic: performance \ No newline at end of file diff --git a/main.py b/main.py index 754750c..45acc4e 100644 --- a/main.py +++ b/main.py @@ -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)