@blueharford/scrypted-spatial-awareness 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueharford/scrypted-spatial-awareness",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Cross-camera object tracking for Scrypted NVR with spatial awareness",
5
5
  "author": "Joshua Seidel <blueharford>",
6
6
  "license": "Apache-2.0",
package/src/main.ts CHANGED
@@ -1827,9 +1827,24 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
1827
1827
  // Calculate position for the landmark WITHIN the camera's field of view
1828
1828
  let position = suggestion.landmark.position;
1829
1829
  if (!position || (position.x === 0 && position.y === 0)) {
1830
- // Find a camera that can see this landmark
1831
- const visibleCameraId = suggestion.landmark.visibleFromCameras?.[0];
1832
- const camera = visibleCameraId ? topology.cameras.find(c => c.deviceId === visibleCameraId) : null;
1830
+ // Debug logging
1831
+ this.console.log(`[Discovery] Processing landmark "${suggestion.landmark.name}"`);
1832
+ this.console.log(`[Discovery] visibleFromCameras: ${JSON.stringify(suggestion.landmark.visibleFromCameras)}`);
1833
+ this.console.log(`[Discovery] Available cameras: ${topology.cameras.map(c => `${c.name}(${c.deviceId})`).join(', ')}`);
1834
+
1835
+ // Find a camera that can see this landmark - use flexible matching (deviceId, name, or case-insensitive)
1836
+ const visibleCameraRef = suggestion.landmark.visibleFromCameras?.[0];
1837
+ const camera = visibleCameraRef ? topology.cameras.find(c =>
1838
+ c.deviceId === visibleCameraRef ||
1839
+ c.name === visibleCameraRef ||
1840
+ c.name.toLowerCase() === visibleCameraRef.toLowerCase()
1841
+ ) : null;
1842
+
1843
+ if (camera) {
1844
+ this.console.log(`[Discovery] Matched camera: ${camera.name}, position: ${JSON.stringify(camera.floorPlanPosition)}, fov: ${JSON.stringify(camera.fov)}`);
1845
+ } else {
1846
+ this.console.warn(`[Discovery] No camera matched for "${visibleCameraRef}"`);
1847
+ }
1833
1848
 
1834
1849
  if (camera?.floorPlanPosition) {
1835
1850
  // Get camera's FOV direction and range (cast to any for flexible access)
@@ -1839,8 +1854,10 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
1839
1854
  const fovAngle = fov.angle || 90;
1840
1855
 
1841
1856
  // Count existing landmarks from this camera to spread them out
1857
+ const cameraDeviceId = camera.deviceId;
1842
1858
  const existingFromCamera = (topology.landmarks || []).filter(l =>
1843
- l.visibleFromCameras?.includes(visibleCameraId)
1859
+ l.visibleFromCameras?.includes(cameraDeviceId) ||
1860
+ l.visibleFromCameras?.includes(camera.name)
1844
1861
  ).length;
1845
1862
 
1846
1863
  // Calculate position in front of camera within its FOV