Skip to content

Commit

Permalink
Update settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
phate999 authored Nov 6, 2023
1 parent 97d21d4 commit c1ac982
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions mqtt_app/settings.py
Original file line number Diff line number Diff line change
@@ -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'
# 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'
}
}

0 comments on commit c1ac982

Please sign in to comment.