Schemas

Contact sensor

Door open/closed state, battery, and tamper observations.

https://hometruth.ai/schemas/contact-sensor · ContactSensor

Instances

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hometruth.ai/schemas/contact-sensor",
  "title": "Contact 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"
        },
        "open": {
          "type": "boolean"
        },
        "batteryPercent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "tampered": {
          "type": "boolean"
        }
      },
      "required": [
        "availability"
      ],
      "dependentRequired": {
        "open": [
          "observedAt"
        ],
        "batteryPercent": [
          "observedAt"
        ]
      }
    }
  },
  "required": [
    "id",
    "state",
    "actions"
  ]
}