@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/dist/plugin.zip CHANGED
Binary file
@@ -40027,6 +40027,7 @@ class SpatialAwarenessPlugin extends sdk_1.ScryptedDeviceBase {
40027
40027
  if (request.method === 'GET') {
40028
40028
  const topologyJson = this.storage.getItem('topology');
40029
40029
  const topology = topologyJson ? JSON.parse(topologyJson) : (0, topology_1.createEmptyTopology)();
40030
+ this.console.log(`[Topology API] GET - drawnZones: ${topology.drawnZones?.length || 0}`);
40030
40031
  response.send(JSON.stringify(topology), {
40031
40032
  headers: { 'Content-Type': 'application/json' },
40032
40033
  });
@@ -40034,6 +40035,10 @@ class SpatialAwarenessPlugin extends sdk_1.ScryptedDeviceBase {
40034
40035
  else if (request.method === 'PUT' || request.method === 'POST') {
40035
40036
  try {
40036
40037
  const topology = JSON.parse(request.body);
40038
+ this.console.log(`[Topology API] PUT received - drawnZones: ${topology.drawnZones?.length || 0}`);
40039
+ if (topology.drawnZones?.length) {
40040
+ this.console.log(`[Topology API] Zone names: ${topology.drawnZones.map(z => z.name).join(', ')}`);
40041
+ }
40037
40042
  this.storage.setItem('topology', JSON.stringify(topology));
40038
40043
  await this.startTrackingEngine(topology);
40039
40044
  response.send(JSON.stringify({ success: true }), {
@@ -40041,6 +40046,7 @@ class SpatialAwarenessPlugin extends sdk_1.ScryptedDeviceBase {
40041
40046
  });
40042
40047
  }
40043
40048
  catch (e) {
40049
+ this.console.error(`[Topology API] PUT error:`, e);
40044
40050
  response.send(JSON.stringify({ error: 'Invalid topology JSON' }), {
40045
40051
  code: 400,
40046
40052
  headers: { 'Content-Type': 'application/json' },
@@ -43723,9 +43729,11 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43723
43729
  // Zone list
43724
43730
  const zoneList = document.getElementById('zone-list');
43725
43731
  const zones = topology.drawnZones || [];
43732
+ console.log('[updateUI] Zone list update - topology.drawnZones:', zones.length, 'zones');
43726
43733
  if (zones.length === 0) {
43727
43734
  zoneList.innerHTML = '<div class="zone-item" style="color: #666; text-align: center; cursor: default; padding: 8px;">No zones drawn</div>';
43728
43735
  } else {
43736
+ console.log('[updateUI] Rendering', zones.length, 'zones:', zones.map(z => z.name).join(', '));
43729
43737
  zoneList.innerHTML = zones.map(z => {
43730
43738
  const color = ZONE_STROKE_COLORS[z.type] || ZONE_STROKE_COLORS.custom;
43731
43739
  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>';