Enabled retrieving all camera names from Frigate API

This commit is contained in:
Ashish D'Souza 2023-07-25 16:17:06 -04:00
parent 9a0bcf6cdc
commit 9c0be03a99
1 changed files with 6 additions and 4 deletions

View File

@ -34,10 +34,12 @@ def reset_all_camera_detection_at_sunset():
seconds_until_sunset = (sunset - datetime.now()).total_seconds()
sleep(seconds_until_sunset)
set_camera_detection('front_door', True)
set_camera_detection('back_door', True)
set_camera_detection('garage', True)
set_camera_detection('family_room', True)
# Get all camera names
frigate_api_response = requests.get('http://frigate:5000/api/config')
frigate_api_response.raise_for_status()
all_camera_names = json.loads(frigate_api_response.content)['cameras'].keys()
for camera_name in all_camera_names:
set_camera_detection(camera_name, True)
def set_camera_detection(camera: str, value: bool, delay: int = 0) -> None: