@@ -143,6 +143,12 @@ async def choose_cam(self, task: Camera_Task):
143
143
"""
144
144
Asynchronously chooses a camera based on various conditions such as
145
145
daylight detection, night vision, and default camera type.
146
+ Decision is:
147
+ - daylight detection enabled:
148
+ - daylight takes default_camera_type
149
+ - night: takes night vision enabled cam, if two precedence is blink over picam
150
+ - daylight detection disabled:
151
+ - takes default_camera_type
146
152
147
153
Args:
148
154
self: The Camera object.
@@ -160,19 +166,22 @@ async def choose_cam(self, task: Camera_Task):
160
166
if self .detect_daylight ():
161
167
self .logger .info ("daylight detected" )
162
168
163
- if not self .config .blink_night_vision :
169
+ if self .config .default_camera_type == DefaultCam . BLINK :
164
170
self .logger .debug ("blink night_vision is disabled" )
165
171
result = await self ._blink_foto_helper (task )
166
172
return await self ._check_blink_result (task , result )
167
173
168
- if not self .config .picam_night_vision :
174
+ if self .config .default_camera_type == DefaultCam . PICAM :
169
175
self .logger .debug ("picam night_vision is disabled" )
170
176
result = await self ._picam_foto_helper (task )
171
177
return await self ._check_picam_result (task , result )
172
178
173
179
else :
174
180
self .logger .info ("night detected is enabled" )
175
181
182
+ # ToDo: improve here if two are enabled for night vision
183
+ # ToDo: further extended unit tests required here
184
+
176
185
if self .config .blink_night_vision :
177
186
self .logger .debug ("blink night_vision is enabled" )
178
187
result = await self ._blink_foto_helper (task )
@@ -184,7 +193,6 @@ async def choose_cam(self, task: Camera_Task):
184
193
return await self ._check_picam_result (task , result )
185
194
186
195
else :
187
- # use default camera
188
196
if self .config .default_camera_type == DefaultCam .BLINK :
189
197
self .logger .debug ("blink as default cam choosen" )
190
198
result = await self ._blink_foto_helper (task )
0 commit comments