Schemas

Occupancy sensor

Presence, zones, and illuminance observations.

https://hometruth.ai/schemas/occupancy-sensor · OccupancySensor

Instances

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hometruth.ai/schemas/occupancy-sensor",
  "title": "Occupancy sensor",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "actions": {
      "type": "object",
      "additionalProperties": false
    },
    "state": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "availability": {
          "enum": [
            "online",
            "offline",
            "degraded",
            "unknown"
          ]
        },
        "detail": {
          "type": "string",
          "maxLength": 500
        },
        "observedAt": {
          "type": "string",
          "format": "date-time"
        },
        "occupied": {
          "type": "boolean"
        },
        "illuminanceLux": {
          "type": "number",
          "minimum": 0
        },
        "zones": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "name": {
                "type": "string"
              },
              "occupied": {
                "type": "boolean"
              },
              "availability": {
                "enum": [
                  "online",
                  "offline",
                  "degraded",
                  "unknown"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "availability"
            ]
          }
        }
      },
      "required": [
        "availability"
      ],
      "dependentRequired": {
        "occupied": [
          "observedAt"
        ],
        "zones": [
          "observedAt"
        ],
        "illuminanceLux": [
          "observedAt"
        ]
      }
    }
  },
  "required": [
    "id",
    "state",
    "actions"
  ]
}