diff --git a/AWX_collector.py b/AWX_collector.py index 1f83c29..393518d 100644 --- a/AWX_collector.py +++ b/AWX_collector.py @@ -8,6 +8,7 @@ import serial.rs485 import subprocess import json import queue +import argparse import paho.mqtt.client as mqtt @@ -31,12 +32,17 @@ ER2: OFF 횟수 ''' +parser = argparse.ArgumentParser() +parser.add_argument('-config',help='') +args = parser.parse_args() + +ROOT_PATH = f"/usr/local/sdt/app/{args.config}" ############################################################################### # JSON FILE READ # ############################################################################### -with open("./connect_info.json","r") as f: +with open(f"{args.config}/connect_info.json","r") as f: info = json.load(f) diff --git a/config.json b/config.json index 1df28a2..755a2d9 100644 --- a/config.json +++ b/config.json @@ -1 +1,34 @@ -ss +{ + "1": 0, + "2": 0, + "3": 1, + "4": 0, + "5": 1, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 1, + "17": 0, + "18": 0, + "19": 0, + "20": 0, + "21": 0, + "22": 0, + "23": 0, + "24": 0, + "25": 0, + "26": 0, + "27": 0, + "28": 0, + "29": 0, + "30": 0, + "31": 0, + "32": 0 +} diff --git a/connect_info.json b/connect_info.json new file mode 100644 index 0000000..4cc2ca1 --- /dev/null +++ b/connect_info.json @@ -0,0 +1,37 @@ +{ + "mqtt":{ + "topic":"/device-data/NQ-R04-TEST-003", + "id":"sdt", + "pw":"251327", + "host_ip":"13.209.39.139", + "port":32259 + }, + "port1":{ + "path": "/dev/ttyMAX1", + "baudrate":57600, + "parity":1, + "stopbits":0, + "bytesize":8 + }, + "port2":{ + "path": "/dev/ttyMAX0", + "baudrate":57600, + "parity":1, + "stopbits":0, + "bytesize":8 + }, + "port3":{ + "path": "/dev/ttyMAX2", + "baudrate":115200, + "parity":1, + "stopbits":0, + "bytesize":8 + }, + "port4":{ + "path": "/dev/ttyMAX3", + "baudrate":115200, + "parity":1, + "stopbits":0, + "bytesize":8 + } +}