Data Storage

Storing data is up to the user to decide a desired method of long term storage. Mudpi though, will store the last sensor readings or relay state in temporary memory store (Redis). This value will be overwritten every time a new value is received. This way it is easy for users to pull values from redis as needed and log them in their own method.

Storing Values

MudPi will backup state in redis for you using the format "{key}.state" where key if the one you specified for the component in your config file.

Note the "key" will be slugged (converted to lowercase and spaces replaced with underscores).

So for example a sensor config of:

{
    "key": "weather_station""
    "interface": "dht",
    "pin": 3
}

Would backup the latest readings in redis with a key of weather_station.state.

Keep in mind keys must be a valid redis key which can be just about anything. However, try to keep this simple but descriptive for your own sake.

Key Values Stored

Other than the component state, there are a few other important values MudPi stores into redis for you. These value are listed below with more information.

Note on keys: storing False in redis can be cast as a string which will read truthy in python. Instead we del the key and only store the key if its True

Main Stored Values

KeyTypeDescription
started_at[Timestamp]Timestamp of when MudPi started running. Useful to check uptime.
state_keys[List]List of component keys that have state backed up and can be read.