From c1ac98213dd890909d4cde9a57e511b854ffa33c Mon Sep 17 00:00:00 2001 From: Alex Terrell Date: Mon, 6 Nov 2023 13:22:08 -0700 Subject: [PATCH] Update settings.py --- mqtt_app/settings.py | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/mqtt_app/settings.py b/mqtt_app/settings.py index d20e087e..b0f717ee 100755 --- a/mqtt_app/settings.py +++ b/mqtt_app/settings.py @@ -1,17 +1,37 @@ -from csclient import EventingCSClient -cp = EventingCSClient('mqtt_app') - -MQTT_CLIENT_ID = cp.get('config/system/system_id') - +# settings.py # MQTT Server settings MQTT_SERVER = 'test.mosquitto.org' MQTT_PORT = 1883 MQTT_USER_NAME = 'anonymous' MQTT_PASSWORD = 'anonymous' -# MQTT Topics -# Topics are named the same as the path to get the data from the -# NCOS device. This was done for simplicity. -GPS_TOPIC = '/status/gps/lastpos' -MODEM_TEMP_TOPIC = '/status/system/modem_temperature' -WAN_CONNECTION_STATE_TOPIC = '/status/wan/connection_state' \ No newline at end of file +# Seconds between publishing +PUBLISH_INTERVAL = 10 + +# Each topic is a dictionary, containing the {name: path} of each value to publish + +topics = { + 'gps': { + 'latitude': '/status/gps/lastpos/latitude', + 'longitude': '/status/gps/lastpos/longitude', + 'age': '/status/gps/lastpos/age', + 'timestamp': '/status/gps/lastpos/timestamp', + 'accuracy': '/status/gps/fix/accuracy', + 'altitude_meters': '/status/gps/fix/altitude_meters', + 'ground_speed_knots': '/status/gps/fix/ground_speed_knots', + 'heading': '/status/gps/fix/heading', + 'satellites': '/status/gps/fix/satellites', + + }, + 'status': { + 'system_id': 'config/system/system_id', + 'active_wan': 'status/wan/primary_device', + 'connection_state': '/status/wan/connection_state', + 'wan_in_bps': 'status/wan/stats/ibps', + 'wan_out_bps': 'status/wan/stats/obps', + 'lan_clients': 'status/lan/clients', + 'wlan_clients': 'status/wlan/clients', + 'temperature': '/status/system/temperature', + 'usb_state': 'status/usb/connection/state' + } +}