MudPi loads everything it needs from a configuration file. This file can be a JSON or YAML format. MudPi by default looks for a file in the root folder named mudpi.config
. You are free to locate this file elsewhere and with a name that you choose. To tell MudPi what config file to load you can use the --config
flag when you run MudPi. mudpi --config /path/to/youconfig.file
MudPi will only load components and extensions found in this configuration file on boot. There should not be empty or null values in this config file. Instead the option should be omitted if it is not used. Place the core configs in the mudpi
key.
Here is the barebone structure of the configuration file.
{
"mudpi": {
"name": "MudPi Testbench",
"debug": false
}
}
You can see there are two sections to the minimal configuration file. Currently name
and debug
are the only required options.
MudPi includes an example configuration file to get you started. You can find this file in the installation root named mudpi.config.example
. You should use this as a reference when creating your own config file.
There are also included examples you can find at mudpi/examples
which contain config files as well.
Option | Type | Required | Description |
name | [String] | Yes | Name of the system. Mainly here for labeling the system and to pull for a UI. |
debug | [Boolean] | Yes | If enabled, MudPi will output more information while the system runs. More information about the startup sequence and each of the cycles will be output. |
unit_system | [String] | No | A string for measurement units. imperial or metric . |
location | [Object] | No | Dict containing latitude and longitude |
events | [Object] | No | Event adapter configurations |
Try booting with only the core configs in order to see if all the dependencies have been installed and if MudPi will successfully run. Below is an example of a configuration I have used to test the system.
{
"mudpi": {
"name": "MudPi Testbench",
"debug": false,
"unit_system": "imperial",
"location": {
"latitude":22.526,
"longitude":-19.043
},
"events": {
"redis": {
"host": "127.0.0.1",
"port": 6379
},
"mqtt": {
"host": "localhost",
"username": "admin",
"password": "admin"
}
}
}
}
Here is the same config in YAML format:
mudpi:
name: MudPi Testbench
debug: false
unit_system: imperial
location:
latitude: 22.526
longitude: -19.043
events:
redis:
host: 127.0.0.1
port: 6379
mqtt:
host: localhost
username: admin
password: admin
If your having trouble getting your configuration file to load make sure to look closely at your value types (i.e. "10" is not the same as 10). Make sure there are no empty settings values, option settings should be removed rather than left empty/null. Check all your quotes, colons, commas, brackets, parenthesis and capitalization.