some improvements

This commit is contained in:
derlole
2025-05-09 18:36:01 +00:00
parent 83e6ff3958
commit 41b276c734
16 changed files with 283 additions and 42 deletions

6
persistence/README.md Normal file
View 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.

View File

@@ -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
View 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)

View File

@@ -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
}