File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def __init__(self, transport):
3131
3232 def poll_parameters (self , ids : range ):
3333 while True :
34- result = {"timestamp" : datetime .datetime .now (). isoformat ( ), "modules" : []}
34+ result = {"timestamp" : datetime .datetime .now (datetime . UTC ), "modules" : []}
3535 for idx in ids :
3636 vals = to_json_serializable (self .get_values_single (idx ))
3737 result ["modules" ].append (vals )
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ def minimize_module(m: json) -> json:
6363
6464def mongo_cleanup (collection , retention_days ):
6565 threshold = datetime .datetime .now () - datetime .timedelta (days = retention_days )
66- collection .delete_many ({"createdAt " : {"$lt" : threshold }})
66+ collection .delete_many ({"ts " : {"$lt" : threshold }})
6767
6868def run (argv : list [str ]):
6969 parser = argparse .ArgumentParser (description = "Pylontech RS485 poller" )
@@ -99,7 +99,7 @@ def run(argv: list[str]):
9999 collection_meta = db [args .mongo_collection_meta ]
100100
101101 collection_hist = db [args .mongo_collection_history ]
102- collection_hist .create_index ("createdAt " , expireAfterSeconds = 3600 * 24 * 90 )
102+ collection_hist .create_index ("ts " , expireAfterSeconds = 3600 * 24 * 90 )
103103
104104 logging .info ("About to start polling..." )
105105 bats = p .scan_for_batteries (2 , 10 )
You can’t perform that action at this time.
0 commit comments