25 lines
541 B
Python
25 lines
541 B
Python
|
import paho.mqtt.client as mqtt
|
||
|
import json
|
||
|
import argparse
|
||
|
|
||
|
from datetime import datetime
|
||
|
import time
|
||
|
import yaml
|
||
|
|
||
|
parser = argparse.ArgumentParser()
|
||
|
parser.add_argument('-app',help='')
|
||
|
args = parser.parse_args()
|
||
|
|
||
|
with open(f'/usr/local/sdt/app/{args.app}/config.json', encoding='UTF-8') as f:
|
||
|
jsonData = json.load(f)
|
||
|
|
||
|
|
||
|
# mqttc = mqtt.Client() # puclisher 이름
|
||
|
# mqttc.username_pw_set("sdt", "251327")
|
||
|
# mqttc.connect("13.209.39.139", 32259)
|
||
|
while True:
|
||
|
print(f"Config value: {jsonData['topic']}", flush=True)
|
||
|
time.sleep(2)
|
||
|
|
||
|
|