Commit Graph

5599 Commits

Author SHA1 Message Date
Claude
83be2800f9
fix: motion dot outside zoom transform, fix activeMotion logic
Two fixes:
1. useCameraActivity: replace broken ternary priority with OR — "OFF"
   (truthy string) was silently blocking camera_activity.motion fallback.
   Now: motion === true (from camera_activity) OR detectingMotion === "ON".
2. DraggableGridLayout: render CameraMotionDot outside the zoom transform
   div so the dot doesn't scale with camera zoom. LivePlayer gets
   showMotionDot={false} to avoid duplicate rendering.

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-18 08:32:56 +00:00
ibs0d
18321ac16f
Merge pull request #69 from ibs0d/revert-68-claude/fix-zoom-statistics-WFvOm
Revert "fix: revert CameraMotionDot, restore built-in LivePlayer motion dot"
2026-03-18 19:12:18 +11:00
ibs0d
fa05857976
Revert "fix: revert CameraMotionDot, restore built-in LivePlayer motion dot" 2026-03-18 19:12:01 +11:00
ibs0d
b1a9833406
Merge pull request #68 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: revert CameraMotionDot, restore built-in LivePlayer motion dot
2026-03-18 18:44:59 +11:00
Claude
76652861b5
fix: revert CameraMotionDot, restore built-in LivePlayer motion dot
Remove the external CameraMotionDot component and showMotionDot={false}
override. The ws.ts fix (camera_activity -> motion topic sync) ensures
useCameraActivity gets fresh data, so the built-in dot in LivePlayer works.

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-18 07:39:00 +00:00
ibs0d
44feb916c2
Merge pull request #66 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: sync {camera}/motion topic from camera_activity updates
2026-03-18 17:51:56 +11:00
Claude
703ffcf82e
fix: sync {camera}/motion topic from camera_activity updates
applyCameraActivity expanded camera_activity into many per-camera
topics ({camera}/enabled/state, {camera}/detect/state, etc.) but
never synced the motion field into {camera}/motion.

This caused a critical bug: a stale retained MQTT "OFF" value in
{camera}/motion would permanently override the live motion state
from camera_activity.motion. In useCameraActivity the detectingMotion
check (truthy string "OFF") took priority over camera_activity.motion,
so activeMotion was always false even with real motion present.

Now applyCameraActivity writes state.motion → {camera}/motion ("ON"/
"OFF"), keeping it in sync with the authoritative camera_activity data.

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-18 05:21:29 +00:00
ibs0d
ea9d96d64c
Merge branch 'blakeblackshear:dev' into dev 2026-03-18 13:24:52 +11:00
ibs0d
5d1be5c171
Merge pull request #65 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: accept boolean | undefined for CameraMotionDot autoLive prop
2026-03-17 18:42:30 +11:00
Claude
621f484b92
fix: accept boolean | undefined for CameraMotionDot autoLive prop
autoLive ?? globalAutoLive can be undefined when useUserPersistence
hasn't hydrated yet. Change the prop type to optional boolean and
treat undefined as the default-true value (show dot unless explicitly
set to false via no-streaming mode).

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-17 07:39:59 +00:00
ibs0d
9836871718
Merge pull request #64 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: replace callback motion dot with direct WS subscription component
2026-03-17 18:16:44 +11:00
Claude
f9885df0e4
fix: replace callback motion dot with direct WS subscription component
The previous approach (useEffect → onActiveMotionChange callback →
parent state update) was unreliable: the dot only appeared if motion
was active at the moment of initial mount but did not react to
subsequent WS motion events.

Root cause: the intermediate state chain breaks because React's
useEffect batching and component re-render timing can cause the
parent state to lag behind or miss updates when motion changes after
mount.

Fix: replace the mechanism entirely with a dedicated CameraMotionDot
component that calls useCameraActivity directly. Being a proper React
component it subscribes to the {camera}/motion WS topic via
useSyncExternalStore and re-renders immediately and reliably whenever
motion state changes — no intermediate callbacks or parent state needed.

- Remove onActiveMotionChange prop from LivePlayer; add showMotionDot
  boolean prop (default true) to suppress the internal dot in grid view
- Remove cameraMotionStates state and setCameraMotionStates from
  DraggableGridLayout
- Add CameraMotionDot component with direct useCameraActivity hook

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-17 03:10:46 +00:00
ibs0d
838fb8471c
Merge pull request #63 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: show motion dot regardless of liveReady in grid callback path
2026-03-17 13:28:36 +11:00
ryzendigo
dc27d4ad16
fix: upload_image parses response body before checking HTTP status (#22475)
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* fix: check HTTP response status before parsing JSON body

upload_image() calls r.json() before checking r.ok. If the server
returns an error response (401, 500, etc) with a non-JSON body,
this raises a confusing JSONDecodeError instead of the intended
'Unable to get signed urls' error message.

Move the r.ok check before the r.json() call.

* style: remove extra blank line for ruff
2026-03-16 17:34:30 -06:00
ryzendigo
7708523865
fix: update correct metric in batch_embed_thumbnail (#22501)
batch_embed_thumbnail processes image thumbnails but reports timing
to text_inference_speed instead of image_inference_speed.
2026-03-16 17:33:40 -06:00
ryzendigo
aea91a91d5
fix: use parameterized query in get_face_ids to prevent SQL injection (#22500)
The name parameter was interpolated directly into the SQL query via
f-string, allowing SQL injection through crafted face name values.

Use a parameterized query with ? placeholder instead.
2026-03-16 17:23:44 -06:00
ryzendigo
722ef6a1fe
fix: wrong index for FPS replacement in preset-http-jpeg-generic (#22465)
Some checks are pending
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
parse_preset_input() uses input[len(_user_agent_args) + 1] to find
the FPS placeholder, but preset-http-jpeg-generic does not include
_user_agent_args at the start of its list (only preset-http-mjpeg-generic
does). The FPS placeholder '{}' is at index 1, not index 3.

This means the detect_fps value overwrites '-1' (the stream_loop
argument) instead of the '{}' FPS placeholder, so the preset always
uses the literal string '{}' as the framerate.
2026-03-16 09:57:14 -06:00
ryzendigo
bd289f3146
fix: pass ffmpeg_path to birdseye encode preset format string (#22462)
When hwaccel_args is a list (not a preset string), the fallback in
parse_preset_hardware_acceleration_encode() calls
arg_map["default"].format(input, output) with only 2 positional args.
But PRESETS_HW_ACCEL_ENCODE_BIRDSEYE["default"] contains {0}, {1}, {2}
expecting ffmpeg_path as the first arg.

This causes IndexError: Replacement index 2 out of range for size 2
which crashes create_config.py on every go2rtc start, taking down
all camera streams.

Pass ffmpeg_path as the first argument to match the preset template.
2026-03-16 09:57:04 -06:00
ryzendigo
c08ec9652f
fix: swap shape indices in birdseye custom logo assignment (#22463)
In BirdsEyeFrameManager.__init__(), the numpy slice that copies the
custom logo (transparent_layer from custom.png alpha channel) onto
blank_frame has shape[0] and shape[1] swapped:

  blank_frame[y:y+shape[1], x:x+shape[0]] = transparent_layer

shape[0] is rows (height) and shape[1] is cols (width), so the row
range needs shape[0] and the column range needs shape[1]:

  blank_frame[y:y+shape[0], x:x+shape[1]] = transparent_layer

The bug is masked for square images where shape[0]==shape[1]. For
non-square images (e.g. 1920x1080), it produces:

  ValueError: could not broadcast input array from shape (1080,1920)
  into shape (1620,1080)

This silently kills the birdseye output process -- no frames are
written to the FIFO pipe, go2rtc exec ffmpeg times out, and the
birdseye restream shows a black screen with no errors in the UI.
2026-03-16 06:48:54 -06:00
ryzendigo
7485b48f0e
fix: iterator exhausted by debug log prevents event cleanup (#22469)
In both expire_snapshots() and expire_clips(), the expired_events
query uses .iterator() for lazy evaluation, but the very next line
calls list(expired_events) inside an f-string for debug logging.
This consumes the entire iterator, so the subsequent for loop that
deletes media files from disk iterates over an exhausted iterator
and processes zero events.

Snapshots and clips for removed cameras are never deleted from disk,
causing gradual disk space exhaustion.

Materialize the iterator into a list before logging so both the
debug message and the cleanup loop use the same data.
2026-03-16 06:48:35 -06:00
ryzendigo
6d7b1ce384
fix: inverted condition causes division by zero in velocity direction check (#22470)
The cosine similarity calculation is guarded by:
  if not np.any(np.linalg.norm(velocities, axis=1))

This enters the block when ALL velocity norms are zero, then divides
by those zero norms. The condition should check that all norms are
non-zero before computing cosine similarity:
  if np.all(np.linalg.norm(velocities, axis=1))

Also fixes debug log that shows average_velocity[0] for both x and y
velocity components (second should be average_velocity[1]).
2026-03-16 06:47:24 -06:00
ryzendigo
e80da2b297
fix: WebSocket connection leaked on WebRTC player cleanup (#22473)
The connect() function creates a WebSocket but never stores the
reference. The useEffect cleanup only closes the RTCPeerConnection
via pcRef, leaving the WebSocket open.

Each time the component re-renders with changed deps (camera switch,
playback toggle, microphone toggle), a new WebSocket is created
without closing the previous one. This leaks connections until the
browser garbage-collects them or the server times out.

Store the WebSocket in a ref and close it in the cleanup function.
2026-03-16 06:47:07 -06:00
ryzendigo
49ffd0b01a
fix: handle custom logo images without alpha channel (#22468)
cv2.imread with IMREAD_UNCHANGED loads the image as-is, but the code
unconditionally indexes channel 3 (birdseye_logo[:, :, 3]) assuming
RGBA format. This crashes with IndexError for:

- Grayscale PNGs (2D array, no channel dimension)
- RGB PNGs without alpha (3 channels, no index 3)
- Fully transparent PNGs saved as grayscale+alpha (2 channels)

Handle all image formats:
- 2D (grayscale): use directly as luminance
- 4+ channels (RGBA): extract alpha channel (existing behavior)
- 3 channels (RGB/BGR): convert to grayscale

Also fixes the shape[0]/shape[1] swap in the array slice that breaks
non-square images (related to #6802, #7863).
2026-03-16 06:46:31 -06:00
ryzendigo
bf2dcfd622
fix: reset active_cameras to set() not list in error handler (#22467)
In BirdsEyeFrameManager.update(), the exception handler on line 756
resets self.active_cameras to [] (a list), but it is initialized as
set() and compared as a set throughout the rest of the code.

Since set() \!= [] evaluates to True even though both are empty, the
next call to update_frame() will incorrectly detect a layout change
and trigger an unnecessary frame rebuild after every exception.
2026-03-16 06:44:26 -06:00
ryzendigo
09df43a675
fix: return ValueError should be raise ValueError (#22474)
escape_special_characters() returns a ValueError object instead of
raising it when the input path exceeds 1000 characters. The exception
object gets used as a string downstream instead of triggering error
handling.
2026-03-16 06:43:56 -06:00
ryzendigo
dfc6ff9202
fix: variable shadowing silently drops object label updates (#22472)
When an existing tracked object's label or stationary status changes
(e.g. sub_label assignment from face recognition), the update handler
declares a new const newObjects that shadows the outer let newObjects.

The label and stationary mutations apply to the inner copy, but
handleSetObjects on line 148 reads the outer variable which was never
mutated. The update is silently discarded.

Remove the inner declaration so mutations apply to the outer variable
that gets passed to handleSetObjects.
2026-03-16 06:43:25 -06:00
ryzendigo
bc29c4ba71
fix: off-by-one error in GpuSelector.get_gpu_arg (#22464)
gpu <= len(self._valid_gpus) should be gpu < len(self._valid_gpus).

The list is zero-indexed, so requesting gpu index equal to the list
length causes an IndexError. For example, with 2 valid GPUs (indices
0 and 1), requesting gpu=2 passes the check (2 <= 2) but
self._valid_gpus[2] is out of bounds.
2026-03-16 06:42:03 -06:00
Claude
81f0164e9c
fix: show motion dot regardless of liveReady in grid callback path
The motionVisible condition gated the external dot (via onActiveMotionChange
callback) on liveReady, causing the dot to stay hidden for cameras in
continuous mode (showStillWithoutActivity=false) while the stream is loading
or reconnecting. Since the parent (DraggableGridLayout) renders the dot
outside the stream viewport, it should reflect actual motion state without
depending on stream load status.

Simplify the callback-path effect to use !!(autoLive && !offline &&
activeMotion) so the dot appears in the grid card whenever motion is active.
The full condition (including liveReady) is still used for the inline dot
rendered inside LivePlayer when no callback is provided.

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-16 12:05:26 +00:00
ibs0d
85a8fef628
Merge pull request #62 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: enable stats collection when onStatsUpdate callback is provided
2026-03-16 21:18:39 +11:00
Claude
3ba0f1e230
fix: enable stats collection when onStatsUpdate callback is provided
getStats was always passed showStats (false in grid view), so underlying
players never collected stats data. Now uses showStats || !!onStatsUpdate
so players collect stats whenever the external callback is present.

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-16 10:14:41 +00:00
ibs0d
ce79054590
Merge pull request #61 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: prevent infinite render loop in zoom overlay callbacks
2026-03-16 21:03:29 +11:00
Claude
89864e364d
fix: prevent infinite render loop in zoom overlay callbacks
Use useRef to store onStatsUpdate/onLoadingChange/onActiveMotionChange
callbacks so useEffect deps don't include the callback references.
Inline arrow functions in .map() change identity every render, causing
the previous useEffect([stats, onCallback]) to re-fire on each parent
re-render, triggering another setState → re-render → infinite loop.

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-16 09:54:16 +00:00
ibs0d
c3465dd611
Merge pull request #60 from ibs0d/claude/fix-zoom-statistics-WFvOm
fix: exclude stats, spinner and motion dot from camera zoom transform
2026-03-16 20:32:14 +11:00
Claude
9307272007
fix: exclude stats, spinner and motion dot from camera zoom transform
Move PlayerStats, ActivityIndicator and motion dot rendering outside the
zoom transform div in DraggableGridLayout so they are not scaled when
the user zooms with Shift+Wheel.

- Add onStatsUpdate, onLoadingChange, onActiveMotionChange callback props
  to LivePlayer; when provided, suppress the internal overlay elements
  and bubble state up to the parent instead
- In DraggableGridLayout, maintain per-camera overlay states and render
  the three overlays as siblings to the zoom div (inside the clipping
  viewport) so they remain at natural size regardless of zoom level

https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
2026-03-16 09:08:43 +00:00
ibs0d
00acb95be4
Merge pull request #59 from ibs0d/claude/remove-grid-spacing-E0vKX
Remove rounded corners from CameraImage (visible during stream load)
2026-03-16 19:40:56 +11:00
Claude
8f4063d162
Remove rounded corners from CameraImage (visible during stream load)
https://claude.ai/code/session_01THf2SuS7hLt9NgstxvKdg8
2026-03-16 08:34:38 +00:00
ibs0d
caaf4e7aae
Merge pull request #58 from ibs0d/claude/remove-grid-spacing-E0vKX
Remove rounded corners from LivePlayer component
2026-03-16 19:22:51 +11:00
Claude
16281f669a
Remove rounded corners from LivePlayer component
https://claude.ai/code/session_01THf2SuS7hLt9NgstxvKdg8
2026-03-16 08:18:40 +00:00
ibs0d
ab6a44f046
Merge pull request #57 from ibs0d/claude/remove-grid-spacing-E0vKX
Remove rounded corners from grid camera cards
2026-03-16 19:07:38 +11:00
Claude
61d399db05
Remove rounded corners from grid camera cards
https://claude.ai/code/session_01THf2SuS7hLt9NgstxvKdg8
2026-03-16 08:05:51 +00:00
ibs0d
78ee50a1ce
Merge pull request #56 from ibs0d/claude/remove-grid-spacing-E0vKX
Fix unused marginValue variable after removing grid spacing
2026-03-16 18:47:39 +11:00
Claude
b22dc4c946
Fix unused marginValue variable after removing grid spacing
Removed marginValue state and useLayoutEffect that calculated font size,
and removed unused useLayoutEffect import.

https://claude.ai/code/session_01THf2SuS7hLt9NgstxvKdg8
2026-03-16 07:36:46 +00:00
ibs0d
8b7e6abe6a
Merge pull request #55 from ibs0d/claude/remove-grid-spacing-E0vKX
Remove grid spacing between cards and from edges
2026-03-16 18:22:56 +11:00
Claude
b7b5b08d53
Remove grid spacing between cards and from edges
Set margin and containerPadding to [0,0] in ResponsiveGridLayout,
removed px-2/my-2/pb-8 from the wrapper div, and updated cellHeight
formula to not account for margins.

https://claude.ai/code/session_01THf2SuS7hLt9NgstxvKdg8
2026-03-16 07:15:11 +00:00
ibs0d
d213edd25b
Merge pull request #54 from ibs0d/claude/fix-storage-stats-sUJof
fix: clean up stale DB recording entries when file is missing on disk
2026-03-16 16:09:17 +11:00
Claude
f528a16065
fix: clean up stale DB recording entries when file is missing on disk
When reduce_storage_consumption() encountered a FileNotFoundError
(file deleted outside Frigate), it silently skipped the recording
without removing it from the database. Over time this caused the DB
to accumulate stale entries, making "Frigate recordings tracked" in
/system#storage dramatically overstate actual disk usage.

The bug also affected cleanup behaviour: stale entries don't count
toward freed-space accounting, so Phase 2 (force-delete retained
recordings) could trigger prematurely when most old entries were stale.

Fix: always append the recording to deleted_recordings regardless of
whether the file existed, so the DB entry is removed. freed-space
accounting is unchanged — FileNotFoundError still does not increment
deleted_segments_size since no actual disk space was recovered.

Applied to both Phase 1 (non-retained) and Phase 2 (retained) loops
inside reduce_storage_consumption().

https://claude.ai/code/session_01DMdSSQhQfTuXmzPtRvJmLB
2026-03-16 04:58:47 +00:00
ibs0d
52f78c9de9
Merge pull request #53 from ibs0d/claude/fix-grid-layout-height-p9ZWo
fix: use callback ref to measure container width after skeleton unmounts
2026-03-16 15:22:43 +11:00
Claude
710dec00fe
fix: use callback ref to measure container width after skeleton unmounts
useLayoutEffect with [] deps only ran on the initial render when
gridContainerRef was null (grid div was hidden behind skeleton).
After skeleton disappeared the div mounted but useLayoutEffect never
re-ran, leaving containerWidth=0 and Responsive invisible (blank screen).

A callback ref fires every time the element mounts, so containerWidth
is always set immediately when the grid div first appears.
2026-03-16 04:12:48 +00:00
ibs0d
8a3eaff22f
Merge pull request #52 from ibs0d/claude/fix-grid-layout-height-p9ZWo
Claude/fix grid layout height p9 z wo
2026-03-16 14:43:56 +11:00
Игорь Владимирович
eb5d985daa revert grid fixes 2026-03-16 12:21:51 +11:00