From fc11e96fc369754e73ad03928567130998d0e18f Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 22 Dec 2024 00:23:05 +0100 Subject: [PATCH] Accept 31 days --- apps/meters_to_ha/meters_to_ha.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/meters_to_ha/meters_to_ha.py b/apps/meters_to_ha/meters_to_ha.py index 0e34d1c..16519e2 100755 --- a/apps/meters_to_ha/meters_to_ha.py +++ b/apps/meters_to_ha/meters_to_ha.py @@ -2090,7 +2090,7 @@ def veolia_to_dict(self, csv_file) -> dict[str, Any] | None: # Verify data integrity : d1 = datetime.strptime(date, "%Y-%m-%d") d2 = datetime.now() - if abs((d2 - d1).days) > 30: + if abs((d2 - d1).days) > 31: raise RuntimeError( f"File contains too old data (monthly?!?): {row!r}" ) @@ -2394,7 +2394,7 @@ def update_veolia_device(self, csv_file): # Verify data integrity : d1 = datetime.strptime(date, "%Y-%m-%d") d2 = datetime.now() - if abs((d2 - d1).days) > 30: + if abs((d2 - d1).days) > 31: raise RuntimeError( "File contains too old data (monthly?!?): " + str(row) @@ -2592,7 +2592,7 @@ def update_veolia_device(self, csv_file): # Verify data integrity : d1 = datetime.strptime(date, "%Y-%m-%d") d2 = datetime.now() - if abs((d2 - d1).days) > 30: + if abs((d2 - d1).days) > 31: raise RuntimeError( f"File contains too old data (monthly?!?): {row!r}" ) @@ -2823,7 +2823,7 @@ def update_grdf_device(self, json_file): # Use the most recent data. continue - if abs((row_date_time - datetime.now(timezone.utc)).days) > 30: + if abs((row_date_time - datetime.now(timezone.utc)).days) > 31: raise RuntimeError( f"File contains too old data (monthly?!?): {row}" )