@blueharford/scrypted-spatial-awareness 0.6.19 → 0.6.20

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.19",
3
+ "version": "0.6.20",
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
@@ -1062,18 +1062,24 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
1062
1062
  if (request.method === 'GET') {
1063
1063
  const topologyJson = this.storage.getItem('topology');
1064
1064
  const topology = topologyJson ? JSON.parse(topologyJson) : createEmptyTopology();
1065
+ this.console.log(`[Topology API] GET - drawnZones: ${topology.drawnZones?.length || 0}`);
1065
1066
  response.send(JSON.stringify(topology), {
1066
1067
  headers: { 'Content-Type': 'application/json' },
1067
1068
  });
1068
1069
  } else if (request.method === 'PUT' || request.method === 'POST') {
1069
1070
  try {
1070
1071
  const topology = JSON.parse(request.body!) as CameraTopology;
1072
+ this.console.log(`[Topology API] PUT received - drawnZones: ${topology.drawnZones?.length || 0}`);
1073
+ if (topology.drawnZones?.length) {
1074
+ this.console.log(`[Topology API] Zone names: ${topology.drawnZones.map(z => z.name).join(', ')}`);
1075
+ }
1071
1076
  this.storage.setItem('topology', JSON.stringify(topology));
1072
1077
  await this.startTrackingEngine(topology);
1073
1078
  response.send(JSON.stringify({ success: true }), {
1074
1079
  headers: { 'Content-Type': 'application/json' },
1075
1080
  });
1076
1081
  } catch (e) {
1082
+ this.console.error(`[Topology API] PUT error:`, e);
1077
1083
  response.send(JSON.stringify({ error: 'Invalid topology JSON' }), {
1078
1084
  code: 400,
1079
1085
  headers: { 'Content-Type': 'application/json' },
@@ -1609,9 +1609,11 @@ export const EDITOR_HTML = `<!DOCTYPE html>
1609
1609
  // Zone list
1610
1610
  const zoneList = document.getElementById('zone-list');
1611
1611
  const zones = topology.drawnZones || [];
1612
+ console.log('[updateUI] Zone list update - topology.drawnZones:', zones.length, 'zones');
1612
1613
  if (zones.length === 0) {
1613
1614
  zoneList.innerHTML = '<div class="zone-item" style="color: #666; text-align: center; cursor: default; padding: 8px;">No zones drawn</div>';
1614
1615
  } else {
1616
+ console.log('[updateUI] Rendering', zones.length, 'zones:', zones.map(z => z.name).join(', '));
1615
1617
  zoneList.innerHTML = zones.map(z => {
1616
1618
  const color = ZONE_STROKE_COLORS[z.type] || ZONE_STROKE_COLORS.custom;
1617
1619
  return '<div class="camera-item ' + (selectedItem?.type === 'zone' && selectedItem?.id === z.id ? 'selected' : '') + '" onclick="selectZone(\\'' + z.id + '\\')" style="border-left: 3px solid ' + color + ';"><div class="camera-name">' + z.name + '</div><div class="camera-info">' + z.type + ' | ' + z.polygon.length + ' points</div></div>';