some improvements
This commit is contained in:
6
persistence/README.md
Normal file
6
persistence/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# THE PERSISTENCE DATA
|
||||
|
||||
## these datasets are some suborderst storage for longer terms.
|
||||
## u could use a Database for that but these datasets are unique and therefore they are stored in jsons to ensure their persistance.
|
||||
|
||||
## an acourding module to read and write to these datasets is given in the modules folder.
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"lastFilled": "2025-05-06 20:56:49.436340+00:00",
|
||||
"lastFilled": "2025-05-09 17:43:12.947434",
|
||||
"fill": 100,
|
||||
"coffeesOnFill": 0,
|
||||
"refilled": 0
|
||||
"refilled": 0,
|
||||
"coffeesOnFill": 0
|
||||
}
|
||||
29
persistence/init.py
Normal file
29
persistence/init.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from modules.persistence import save_dict
|
||||
from datetime import datetime, UTC
|
||||
|
||||
# Defaults
|
||||
water = {
|
||||
"lastFilled": str(datetime.now(UTC)),
|
||||
"fill": 100,
|
||||
"coffeesOnFill": 0
|
||||
}
|
||||
|
||||
beans = {
|
||||
"lastFilled": str(datetime.now(UTC)),
|
||||
"fill": 100,
|
||||
"coffeesOnFill": 0
|
||||
}
|
||||
|
||||
machine = {
|
||||
"state": "idle",
|
||||
"connected": False,
|
||||
"ready": False,
|
||||
"peding_command": False,
|
||||
"error": False,
|
||||
"lastConnectionProof": str(datetime.now(UTC))
|
||||
}
|
||||
|
||||
# In JSON-Dateien speichern
|
||||
save_dict("water", water)
|
||||
save_dict("beans", beans)
|
||||
save_dict("machine", machine)
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"lastFilled": "2025-05-06 20:56:49.436328+00:00",
|
||||
"fill": 21,
|
||||
"lastFilled": "2025-05-09 17:40:58.290140",
|
||||
"fill": 100,
|
||||
"coffeesOnFill": 0,
|
||||
"refilled": 0
|
||||
}
|
||||
Reference in New Issue
Block a user