I spent a little time this evening extending Mud-Py.
It now has all tables and organization I think it's going to need, There might be new data columns, but I'm pretty sure the structure is there.
This is the management page:
The "Authenitication and Authorization" section is a gimme from Django - automatically there, and gives you full ability to manage users and their access to various parts of the system.
I implemented the rest of them with content and linkages as I think they need to be.
Given the way the parts are all interlinked, you have to have a Zone before you can have a Control Node. You have to have a Control Node before you can have a Sensor, and you have to have a Sensor before you can have a Sensor Data.
Sensor data is where most of the information will land.
Sensor data looks like this:
Manual data entry looks like this:
Manual data entry is nice, but not what this is all about.
The nice thing about Django is that besides automatically making nifty management pages, you can also call the underlying Python classes from other programs.
The MQTT/Mud-Py bridge will do exactly that - call the Control Node class methods to assign sensors to the ESP32S nodes, then call the Sensor class methods to insert data from the sensors in the Mud-Pi database.
I haven't got things arranged to show the sensors with the control nodes in the correct zone on a map yet, but all of the tables are linked with foreign keys such that you can start on a zone and get all of the control nodes, then all of the sensors, then all of the sensor data that belongs to that zone.
With the structure in place, I can start working on the MQTT/Mud-Py bridge. Everything the bridge needs on the Mud-Pi side is in place.
I switched from using a simple text editor to using the Eric Python IDE. Yesterday when I was working the first couple of classes, I often times had the same file open in multiple editors - I kept getting lost in all the windows open on my desktop.
The Django structure causes you to have many files with the same names. They are in different folders, but it is still very easy to get lost when switching back and forth between the various "apps" as Django calls the subsections of a project.
There's a Django plugin for Eric that makes the database actions a breeze.