MQTT Stopwatch / Display
MQTT Stopwatch / Display
Parts to Buy
Parts to 3d Print
Mechanical Assembly
CircuitPython Setup
Software
The Secrets File
The Config File
Message Protocol
Setup Your Own Broker
Extending
The Secrets File (MQTT Stopwatch / Display)
The secrets file is used to hold the private or secure information needed to access the network and cloud services. This allows the basic code to remain unchanged between applications, and allows software to be shared without sharing private information (share the software, but don't share the secrets file...).
# This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it
secrets = {
'ssid' : '_your_ssid_name',
'password' : '_your wifi_password',
'broker' : '192.168.86.234',
'port' : 1883,
'user' : '_your_mqtt_broker_username_',
'pass' : '_your_mqtt_broker_password_'
}
This file is named "secrets.py" and is placed at the root of the filesystem (in the same folder that files such as "code.py" are placed).
A generic template for the file is provided in the Github. You will need to edit the file, or create an equivalent one from scratch in the format shown. If you use the provided template file, be sure to rename it as "secrets.py".
Enter the approprate values in the dictionary fields and save it to your MatrixPortal. Note that 'user' and 'pass' are authentication values for your MQTT broker, if required. If your broker does not require authentication, you should still leave the entries, but their values will be ignored.