From f069bf22abb434ae8e43146e30193eedeb0a81cd Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Tue, 2 Jan 2024 16:02:27 -0700 Subject: [PATCH] Make data full range --- frigate/http.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frigate/http.py b/frigate/http.py index e24938d88..4c7a01b67 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -737,10 +737,33 @@ def hourly_timeline_activity(camera_name: str): ) check = (key + timedelta(hours=1)).timestamp() + # set initial start so data is representative of full hour + hours[int(key.timestamp())].append( + { + "date": key.timestamp(), + "count": 0, + "type": "motion", + } + ) + for recording in all_recordings: if recording.start_time > check: + hours[int(key.timestamp())].append( + { + "date": (key + timedelta(hours=1)).timestamp(), + "count": 0, + "type": "motion", + } + ) key = key + timedelta(hours=1) check = (key + timedelta(hours=1)).timestamp() + hours[int(key.timestamp())].append( + { + "date": key.timestamp(), + "count": 0, + "type": "motion", + } + ) data_type = "motion" if recording.objects == 0 else "objects" hours[int(key.timestamp())].append(