27 lines
461 B
Python
27 lines
461 B
Python
import json
|
|
|
|
# MQTT配置
|
|
BROKER = "127.0.0.1"
|
|
MQTT_PORT = 1883
|
|
USER = "test"
|
|
PWD = "test"
|
|
|
|
# Modbus配置
|
|
TIMEOUT = 0.1
|
|
BYTESIZE = 8
|
|
PARITY = 'N'
|
|
STOPBITS = 1
|
|
|
|
# MQTT主题
|
|
DEVICE_STATUS_TOPIC = "device/status"
|
|
DEVICE_CONTROL_TOPIC = "device/control"
|
|
SERVICE_STATUS_TOPIC = "service/status"
|
|
|
|
CONFIG_FILE = "/home/admin/.config/cpy/sensor.json"
|
|
|
|
try:
|
|
with open(CONFIG_FILE, "r") as f:
|
|
config = json.load(f)
|
|
except FileNotFoundError:
|
|
config = {}
|