Schemas

Light

Light state and optional power, brightness, color-temperature, color, and effect actions.

https://hometruth.ai/schemas/light · Light

Instances

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hometruth.ai/schemas/light",
  "title": "Light",
  "description": "A light component with optional dimming, color temperature, color, and effect controls.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "state": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "availability": {
          "enum": [
            "online",
            "offline",
            "degraded",
            "unknown"
          ]
        },
        "observedAt": {
          "type": "string",
          "format": "date-time"
        },
        "stateSource": {
          "const": "commanded"
        },
        "commandedAt": {
          "type": "string",
          "format": "date-time"
        },
        "detail": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "on": {
          "type": "boolean"
        },
        "brightnessPercent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "colorTemperatureKelvin": {
          "type": "integer",
          "minimum": 1000,
          "maximum": 40000
        },
        "color": {
          "type": "string",
          "pattern": "^#[0-9A-Fa-f]{6}$"
        },
        "effect": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      },
      "required": [
        "availability"
      ]
    },
    "actions": {
      "type": "object",
      "additionalProperties": false,
      "minProperties": 1,
      "properties": {
        "turnOn": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "turnOff": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "toggle": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "setBrightness": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "minimumPercent": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "maximumPercent": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "stepPercent": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 100
            },
            "maximumTransitionMs": {
              "type": "integer",
              "minimum": 0,
              "maximum": 86400000
            }
          },
          "required": [
            "minimumPercent",
            "maximumPercent"
          ]
        },
        "setColorTemperature": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "minimumKelvin": {
              "type": "integer",
              "minimum": 1000,
              "maximum": 40000
            },
            "maximumKelvin": {
              "type": "integer",
              "minimum": 1000,
              "maximum": 40000
            },
            "stepKelvin": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          "required": [
            "minimumKelvin",
            "maximumKelvin"
          ]
        },
        "setColor": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "formats": {
              "type": "array",
              "minItems": 1,
              "maxItems": 10,
              "uniqueItems": true,
              "items": {
                "enum": [
                  "hex",
                  "rgb",
                  "hsv",
                  "cie-xy"
                ]
              }
            }
          },
          "required": [
            "formats"
          ]
        },
        "setEffect": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "effects": {
              "type": "array",
              "minItems": 1,
              "maxItems": 100,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            }
          },
          "required": [
            "effects"
          ]
        }
      }
    }
  },
  "required": [
    "id",
    "state"
  ]
}