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 store sensor values and relay state in redis for you using the "key" you specified for the sensor in the mudpi.config file.

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

So for example a sensor config of:

{
    "pin": "3",
    "type": "Humidity",
    "key": "weather_station"
}

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

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 in Redis

Other than the sensor readings and relay 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.
last_camera_image[String]Full path and file name of the last image saved by the camera worker.