{
  "pluginAlias": "Hue",
  "pluginType": "platform",
  "singular": true,
  "headerDisplay": "Homebridge plugin for Philips Hue.",
  "footerDisplay": "For a detailed description, see the [wiki](https://github.com/ebaauw/homebridge-hue/wiki/Configuration)",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "description": "Plugin name as displayed in the Homebridge log.",
        "type": "string",
        "required": true,
        "default": "Hue"
      },
      "anyOn": {
        "description": "Expose state.any_on as AnyOn characteristic.",
        "type": "boolean",
        "default": true
      },
      "brightnessAdjustment": {
        "description": "Adjustment factor for brightness for adaptive lighting.  Default: 100.",
        "type": "integer",
        "placeholder": 100,
        "minimum": 10,
        "maximum": 100
      },
      "configuredName": {
        "description": "Expose Configured Name characteritic.  Default: false.",
        "type": "boolean"
      },
      "excludeSensorTypes": {
        "description": "Sensor types to exclude.",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "forceHttp": {
        "description": "Use plain HTTP instead of HTTPS.  Default: false.<br>Note that this will also disable the use of the Hue bridge event stream.",
        "type": "boolean"
      },
      "groups": {
        "description": "Expose groups.",
        "type": "boolean"
      },
      "group0": {
        "description": "Expose group 0 (all lights).",
        "type": "boolean"
      },
      "heartrate": {
        "description": "Heartbeat interval in seconds.  Default: 5.",
        "type": "integer",
        "placeholder": 5,
        "minimum": 1,
        "maximum": 30
      },
      "hosts": {
        "title": "Bridges",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "hueDimmerRepeat": {
        "description": "Enable repeat mode for the Hue dimmer switch (Dim Up and Dim Down buttons) and the Hue smart button.",
        "type": "boolean"
      },
      "hueMotionTemperatureHistory": {
        "description": "Expose the temperature sensor of the Hue motion sensor as a separate HomeKit accessory, to enable temperature history in Eve.",
        "type": "boolean"
      },
      "homebridgeHue2": {
        "title": "Homebridge Hue2",
        "description": "ID of the Homebridge Hue2 migration resource link.",
        "type": "string"
      },
      "lights": {
        "description": "Expose /lights resources, used for lights, plugs, and wired switches.",
        "type": "boolean"
      },
      "linkButton": {
        "description": "Expose the link button on the Hue bridge.",
        "type": "boolean"
      },
      "lowBattery": {
        "description": "Threshold for low battery.  Default: 25%.",
        "type": "integer",
        "minimum": 0,
        "maximum": 100
      },
      "nativeHomeKitLights": {
        "description": "Don't expose /lights resources already exposed by the v2 (square) Hue bridge.",
        "type": "boolean",
        "default": true
      },
      "nativeHomeKitSensors": {
        "description": "Don't expose /sensors resources already exposed by the v2 (square) Hue bridge.",
        "type": "boolean",
        "default": true
      },
      "noResponse": {
        "description": "Report unreachable lights as <i>No Response</i> in HomeKit.",
        "type": "boolean"
      },
      "ownResourcelinks": {
        "description": "Only consider resource links owned by the API key running Homebridge Hue.",
        "type": "boolean"
      },
      "parallelRequests": {
        "description": "The number of ansynchronous requests homebridge-hue sends in parallel to a Hue bridge.  Default: 3 or 10 (depending on the bridge).",
        "type": "integer",
        "minimum": 1,
        "maximum": 30
      },
      "resetTimeout": {
        "description": "The time, in milliseconds, after which pulse-like controls (e.g. for recalling a scene) reset.  Default: 500.",
        "type": "integer",
        "minimum": 10,
        "maximum": 2000
      },
      "resource": {
        "description": "Expose a Resource characteristic.",
        "type": "boolean",
        "default": true
      },
      "rooms": {
        "description": "Include Room groups.",
        "type": "boolean"
      },
      "rules": {
        "description": "Expose rules.",
        "type": "boolean"
      },
      "scenes": {
        "description": "Expose scenes.",
        "type": "boolean"
      },
      "scenesAsSwitch": {
        "description": "Expose scenes as Switch service.",
        "type": "boolean"
      },
      "schedules": {
        "description": "Expose schedules.",
        "type": "boolean"
      },
      "sensors": {
        "description": "Expose /sensors resources, used for sensors and wireless switches.",
        "type": "boolean"
      },
      "stealth": {
        "description": "Stealth mode: don't make any calls to the Internet.  Default: false.",
        "type": "boolean"
      },
      "timeout": {
        "description": "The timeout in seconds to wait for a response from a Hue bridge.  Default: 5.",
        "type": "integer",
        "minimum": 1,
        "maximum": 30
      },
      "users": {
        "type": "object",
        "patternProperties": {
          "^[A-Z0-9]{16}$": {
            "type": "string"
          }
        },
        "minProperties": 1
      },
      "waitTimePut": {
        "description": "The time, in milliseconds, to wait after sending a PUT request, before sending the next PUT request.  Default: 50.",
        "type": "integer",
        "minimum": 0,
        "maximum": 50
      },
      "waitTimePutGroup": {
        "description": "The time, in milliseconds, to wait after sending a PUT request to a group, before sending the next PUT request.  Default: 1000.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000
      },
      "waitTimeResend": {
        "description": "The time, in milliseconds, to wait before resending a request after an ECONNRESET or http status 503 error.  Default: 300.",
        "type": "integer",
        "minimum": 100,
        "maximum": 1000
      },
      "waitTimeUpdate": {
        "description": "The time, in milliseconds, to wait for a change from HomeKit to another characteristic for the same light or group, before updating the Hue bridge.  Default: 20.",
        "type": "integer",
        "minimum": 0,
        "maximum": 500
      },
      "wallSwitch": {
        "description": "Indicate that you use traditional wall switches to power off your lights.",
        "type": "boolean"
      }
    }
  },
  "form": [
    "name",
    {
      "key": "hosts",
      "type": "array",
      "items": {
        "title": "Bridge",
        "description": "Hostname or IPv4 address of the Hue bridge.",
        "type": "string"
      }
    },
    "users",
    {
      "type": "fieldset",
      "expandable": true,
      "title": "Migration",
      "description": "Migrate Homebridge Hue2.",
      "items": [
        "homebridgeHue2"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "Resource types",
      "description": "Select what resource types to expose.",
      "items": [
        "sensors",
        {
          "key": "excludeSensorTypes",
          "type": "checkboxes",
          "titleMap": [
            {
              "name": "ZigBee Switch",
              "value": "ZLLSwitch"
            },
            {
              "name": "ZigBee Rotary Switch",
              "value": "ZLLRelativeRotary"
            },
            {
              "name": "ZigBee Green Power switch",
              "value": "ZGPSwitch"
            },
            {
              "name": "ZigBee Motion Sensor",
              "value": "ZLLPresence"
            },
            {
              "name": "ZigBee Light Level Sensor",
              "value": "ZLLLightLevel"
            },
            {
              "name": "ZigBee Temperature Sensor",
              "value": "ZLLTemperature"
            },
            {
              "name": "Built-in Daylight Sensor",
              "value": "Daylight"
            },
            {
              "name": "CLIP Flag",
              "value": "CLIPGenericFlag"
            },
            {
              "name": "CLIP Status",
              "value": "CLIPGenericStatus"
            },
            {
              "name": "CLIP Presence Sensor",
              "value": "CLIPPresence"
            },
            {
              "name": "CLIP Light Level Sensor",
              "value": "CLIPLightLevel"
            },
            {
              "name": "CLIP Temperature Sensor",
              "value": "CLIPTemperature"
            },
            {
              "name": "CLIP Door/Window Sensor",
              "value": "CLIPOpenClose"
            },
            {
              "name": "Geofence",
              "value": "Geofence"
            },
            {
              "name": "Any CLIP sensor",
              "value": "CLIP"
            }
          ],
          "condition": {
            "functionBody": "return model.sensors"
          }
        },
        {
          "key": "nativeHomeKitSensors",
          "condition": {
            "functionBody": "return model.sensors"
          }
        },
        "lights",
        {
          "key": "nativeHomeKitLights",
          "condition": {
            "functionBody": "return model.lights"
          }
        },
        "groups",
        {
          "key": "group0",
          "condition": {
            "functionBody": "return model.groups"
          }
        },
        {
          "key": "anyOn",
          "condition": {
            "functionBody": "return model.groups"
          }
        },
        {
          "key": "rooms",
          "condition": {
            "functionBody": "return model.groups"
          }
        },
        {
          "key": "scenes",
          "condition": {
            "functionBody": "return model.groups"
          }
        },
        {
          "key": "scenesAsSwitch",
          "condition": {
            "functionBody": "return model.groups && model.scenes"
          }
        },
        "linkButton",
        "schedules",
        "rules"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "How",
      "description": "Select how to expose the resources.",
      "items": [
        {
          "key": "hueDimmerRepeat",
          "condition": {
            "functionBody": "return model.sensors"
          }
        },
        {
          "key": "hueMotionTemperatureHistory",
          "condition": {
            "functionBody": "return model.sensors"
          }
        },
        "resource",
        {
          "key": "wallSwitch",
          "condition": {
            "functionBody": "return model.lights"
          }
        }
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "Advanced Settings",
      "description": "Don't change these, unless you understand what you're doing.",
      "items": [
        {
          "key": "brightnessAdjustment",
          "condition": {
            "functionBody": "return model.lights"
          }
        },
        "configuredName",
        "forceHttp",
        "heartrate",
        {
          "key": "noResponse",
          "condition": {
            "functionBody": "return model.lights"
          }
        },
        "ownResourcelinks",
        "parallelRequests",
        "resetTimeout",
        "stealth",
        "timeout",
        "waitTimePut",
        {
          "key": "waitTimePutGroup",
          "condition": {
            "functionBody": "return model.groups"
          }
        },
        "waitTimeResend",
        "waitTimeUpdate"
      ]
    }
  ]
}
