check ok
This commit is contained in:
parent
c927f89c5d
commit
10d67c039b
|
@ -7,6 +7,7 @@ import minimalmodbus
|
|||
import serial.rs485
|
||||
import subprocess
|
||||
import json
|
||||
import yaml
|
||||
import queue
|
||||
import paho.mqtt.client as mqtt
|
||||
import numpy as np
|
||||
|
@ -38,6 +39,7 @@ parser.add_argument('-config',help='')
|
|||
args = parser.parse_args()
|
||||
|
||||
ROOT_PATH = f"/usr/local/sdt/app/{args.config}"
|
||||
DEVICE_PATH = f"/etc/sdt/device-control"
|
||||
|
||||
###############################################################################
|
||||
# JSON FILE READ #
|
||||
|
@ -47,6 +49,10 @@ with open(f"{ROOT_PATH}/connect_info.json","r") as f:
|
|||
#with open(f"{args.config}/connect_info.json","r") as f:
|
||||
info = json.load(f)
|
||||
|
||||
with open(f"{DEVICE_PATH}/config.yaml","r") as f:
|
||||
#with open(f"{args.config}/connect_info.json","r") as f:
|
||||
dev_info = yaml.load(f, Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Shared memory setting #
|
||||
|
@ -65,8 +71,6 @@ a = [ data[str(n+1)] for n in range(64)]
|
|||
a = np.array(a)
|
||||
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Get Data from Shared Memory #
|
||||
###############################################################################
|
||||
|
@ -80,7 +84,8 @@ b[:] = a[:]
|
|||
# MQTT Broker Setting #
|
||||
###############################################################################
|
||||
|
||||
MQTT_TOPIC = info['mqtt']['topic']
|
||||
#MQTT_TOPIC = info['mqtt']['topic']
|
||||
MQTT_TOPIC = dev_info['assetcode']
|
||||
MQTT_ID = info['mqtt']['id']
|
||||
MQTT_PW = info['mqtt']['pw']
|
||||
MQTT_HOST_IP = info['mqtt']['host_ip']
|
||||
|
|
|
@ -7,3 +7,6 @@ sudo cp /usr/local/sdt/app/$1/AWX_collector.service /etc/systemd/system/$1.servi
|
|||
sudo cp /usr/local/sdt/app/$1/AWX_shm_updater.service /etc/systemd/system/AWX_shm_updater.service
|
||||
sudo systemctl start $1
|
||||
sudo systemctl enable $1
|
||||
|
||||
sudo systemctl start AWX_shm_updater
|
||||
sudo systemctl enable AWX_shm_updater
|
||||
|
|
Loading…
Reference in New Issue