36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
import time
|
|
|
|
# Modbus configuration
|
|
MODBUS_HOSTS = [
|
|
{"ip": "10.84.60.31", "location": "Warehouse-B", "type": "temperature_humidity"},
|
|
{"ip": "10.84.60.32", "location": "Warehouse-C", "type": "temperature_humidity"},
|
|
{"ip": "10.84.60.33", "location": "Dyeing-Kitchen", "type": "temperature_humidity"},
|
|
{"ip": "10.84.60.34", "location": "Second-Floor", "type": "temperature_humidity"},
|
|
{"ip": "10.84.60.35", "location": "Warehouse-A", "type": "temperature_humidity"},
|
|
{"ip": "10.84.60.36", "location": "Lab-Room", "type": "temperature_humidity"},
|
|
{"ip": "10.84.60.37", "location": "Office", "type": "cwt_co2"},
|
|
]
|
|
MODBUS_PORT = 505
|
|
UNIT_ID = 1
|
|
|
|
# MQTT configuration
|
|
MQTT_BROKER = "mqtt.service.mesh"
|
|
MQTT_PORT = 1883
|
|
# Legacy topic - now using dynamic topic structure: {location}/{sensor_type}/data
|
|
MQTT_TOPIC = "Temperature_Humidity" # Keep for backward compatibility
|
|
MQTT_CLIENT_ID = f"modbus-mqtt-client-{int(time.time())}"
|
|
MQTT_USERNAME = "relay"
|
|
MQTT_PASSWORD = "Sey@K9c&Q4^"
|
|
|
|
# Read and publish cycle configuration (seconds)
|
|
PUBLISH_INTERVAL = 10
|
|
|
|
# Health check and alerting configuration
|
|
HEALTH_CHECK_PORT = 8080
|
|
HEALTH_CHECK_ENABLED = True
|
|
|
|
# Alerting configuration
|
|
ALERTING_ENABLED = True
|
|
SENSOR_TIMEOUT_THRESHOLD = 3 # Number of consecutive failures before alert
|
|
RECOVERY_CONFIRMATION_COUNT = 2 # Number of consecutive successes to confirm recovery
|