Configuration File Notes - SteveCossy/IOT GitHub Wiki
What I propose (& might take more than one Capstone Project) is:
- A single 'blob' of Python code for any of your projects. This will be cloned on to each Pi from Github. That will be the 'guts of code' you refer to below.
- One or more text files in the 'home' folder ( /home/pi ) which define what this particular device is going to do.
- It might include things like:
- Version Info - provision for changes (hopefully backwards compatible) to the spec for this file. Will be tested in the Python code, with appropriate warnings.
- Program Info - (The gateway, RF link, Choice of MQTT broker, engineering level).
- Authentication - Username, Password, ClientID
- LoRa and data details - Channels, units and scales and 'Tags' and 'Descriptors'
- Comments can be added to this section to describe what the device is doing. The comments could Defines what each channel is doing what, where, why and how,
This is all quite doable. I've been doing the authentication bit for years. It just needs input from Andrew to suggest what is needed and competent students to document it, then implement it in Python!
Below is an example of what a configuration file might look like. It is a very rough idea so suggest what I have in mind.
That's all I have time for tonight ....
Cheers!
Steve
# Configuration file for Zealandia stream water and lake level, flow %O2, hydrology 'abiotic' Project # Created by Andrew Hornblow 3 March 2021 # Last edited by Steve Cosgrove 23 January 2022 [authentication] # This section defines the credentials necessary to connect to the MQTT broker listed below CayUsername = "3bc69df0-6ead-11e8-8e48-275f329dc9d5" CayPassword = "0a1ecb3d7d05288aa5691633c0d5632933819243" CayClientID = "adeef670-4bcd-11eb-b767-3f1a8f1211ba" [data-definition] # List of mappings being used on this device # Defaults are set by running ~/IOT/utils/mkConfigFile.py # Any of these values can be changed as required for this device One-Channel = '1' One-Purpose = 'QoS' One- One-Max = '5000 One-Min = '0' One-Divisor = '10' Two-Channel = '2' etc ... [program-info] # Settings used to set up this device when code is run Broker-Address = 'mqtt.mydevices.com" Broker-Port = '1883' Broker-Keepalive = '60' HomeDir = '/home/pi' CsvPath = '/home/pi/CSVfiles' # Location of local copy of data read by this sensor UpdateFreq = '60' # Seconds between sending updates to broker [connection-one] ConnectionType = 'serial' # Can be serial, USB, GPIO ConnectionSerial = "/dev/ttyAMA0" # Default location of serial port on pre 3 Pi models # SERIAL_PORT = "/dev/ttyAMA0" # Default location of serial port on Pi models 3 and Zero # SERIAL_PORT = "/dev/ttyS0" # USB ports are another option SerialBaud = '2400' SerialTimeout = '5'