Schemas

Sensor collection

Named measurements with units, timestamps, and individual availability on one device.

https://hometruth.ai/schemas/sensor-collection · SensorCollection

Instances

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hometruth.ai/schemas/sensor-collection",
  "title": "Sensor collection",
  "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"
        },
        "sensors": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "quantity": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "unit": {
                "type": "string",
                "maxLength": 30
              },
              "availability": {
                "enum": [
                  "online",
                  "offline",
                  "degraded",
                  "unknown"
                ]
              },
              "detail": {
                "type": "string",
                "maxLength": 500
              },
              "observedAt": {
                "type": "string",
                "format": "date-time"
              },
              "value": {
                "type": "number"
              },
              "source": {
                "type": "string",
                "maxLength": 100
              }
            },
            "required": [
              "id",
              "name",
              "quantity",
              "unit",
              "availability"
            ],
            "dependentRequired": {
              "value": [
                "observedAt"
              ]
            }
          }
        }
      },
      "required": [
        "availability",
        "sensors"
      ]
    }
  },
  "required": [
    "id",
    "state",
    "actions"
  ]
}