{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trinetrahq.com/schemas/sangam/1.0/sensor_status.schema.json",
  "title": "SANGAM SensorStatus",
  "description": "Health, location and coverage of one sensor. Sensors publish one on start, on every change, and at least once a minute. The fusion engine stops counting misses against tracks for a sensor that is offline.",
  "type": "object",
  "required": ["type", "schema_version", "sensor_id", "sensor_type", "time", "health"],
  "properties": {
    "type": {"const": "sensor_status", "description": "Record type."},
    "schema_version": {"$ref": "common.schema.json#/$defs/schemaVersion"},
    "sensor_id": {"$ref": "common.schema.json#/$defs/id", "description": "Sensor id, used by every Detection it reports."},
    "sensor_type": {"$ref": "common.schema.json#/$defs/sensorType"},
    "time": {"$ref": "common.schema.json#/$defs/time"},
    "health": {"enum": ["ok", "degraded", "offline"]},
    "name": {"type": "string", "maxLength": 120},
    "position": {"$ref": "common.schema.json#/$defs/point"},
    "coverage": {
      "description": "Instrumented coverage: maximum range and a clockwise sector from sector_from_deg to sector_to_deg. A full circle is 0 to 360.",
      "type": "object",
      "required": ["range_m"],
      "properties": {
        "range_m": {"type": "number", "exclusiveMinimum": 0},
        "sector_from_deg": {"type": "number", "minimum": 0, "maximum": 360},
        "sector_to_deg": {"type": "number", "minimum": 0, "maximum": 360},
        "line": {
          "description": "For fence sensors: the instrumented line as [lat, lon] pairs.",
          "type": "array",
          "minItems": 2,
          "items": {"$ref": "common.schema.json#/$defs/latLon"}
        }
      },
      "additionalProperties": false
    },
    "rate_hz": {"type": "number", "exclusiveMinimum": 0, "description": "Nominal report or scan rate."},
    "latency_s": {"type": "number", "minimum": 0, "description": "Typical delay from measurement to delivery."},
    "detections_last_min": {"type": "integer", "minimum": 0},
    "message": {"type": "string", "maxLength": 280},
    "vendor": {"type": "string", "maxLength": 80},
    "model": {"type": "string", "maxLength": 80},
    "attributes": {"$ref": "common.schema.json#/$defs/attributes"},
    "simulated": {"type": "boolean"}
  },
  "additionalProperties": false,
  "examples": [
    {
      "type": "sensor_status",
      "schema_version": "1.0",
      "sensor_id": "IR-S",
      "sensor_type": "ir",
      "time": "2026-10-20T16:13:00.000Z",
      "health": "offline",
      "name": "Thermal camera, south tower",
      "position": {"lat": 22.56912, "lon": 88.93583, "height_m": 18},
      "coverage": {"range_m": 3000, "sector_from_deg": 330, "sector_to_deg": 120},
      "rate_hz": 1,
      "latency_s": 0.6,
      "message": "Video analytics restarting",
      "simulated": true
    }
  ]
}
