Initial content, migrated from the aml gateway rpi7-am-1

This commit is contained in:
2026-10-02 19:48:16 +02:00
parent b17f125d2d
commit e83ecb5bfc
4 changed files with 46 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
from i7lib.dbutils import Database
from i7lib.timeutils import to_datetime
def main():
db = Database()
rows = db.query(
"oven_bar",
filters=[
{"column": "exited_time", "op": "eq", "value": 0},
{"column": "deleted", "op": "eq", "value": 0},
],
)
if not rows:
print("no orphan bars to close")
return
for row in rows:
db.update("oven_bar", row["id"], {"exited_time": row["entered_time"]})
dt = to_datetime(row["entered_time"]).strftime("%Y-%m-%d %H:%M:%S")
print(f"closed orphan bar id={row['id']}, entered_time={dt}")
print(f"closed {len(rows)} orphan bar(s)")
if __name__ == "__main__":
main()