{
  "pluginAlias": "NB",
  "pluginType": "platform",
  "singular": true,
  "headerDisplay": "Homebridge plugin for Nuki Bridge",
  "footerDisplay": "",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "description": "Plugin name as displayed in the Homebridge log.",
        "type": "string",
        "required": true,
        "default": "Nuki"
      },
      "bridges": {
        "title": "Bridges",
        "description": "Nuki bridges (default: discovered automatically).",
        "type": "array",
        "items": {
          "title": "Bridge",
          "description": "Nuki bridge configuration.",
          "required": true,
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "bridgeId": {
              "title": "Bridge ID",
              "description": "Nuki ID of the bridge.",
              "type": "string",
              "required": true
            },
            "host": {
              "title": "Host",
              "description": "IP address or hostname of the bridge.",
              "type": "string",
              "required": true
            }
          }
        }
      },
      "devices": {
        "title": "Device",
        "description": "Whitelisted Nuki devices (default: all).<br>Make sure to include the Nuki bridge to which the device is connected.",
        "type": "array",
        "items": {
          "title": "Device",
          "description": "Nuki ID of the device.",
          "type": "string"
        }
      },
      "encryption": {
        "description": "Encryption for Nuki bridge token.  Default: Encrypted.",
        "type": "string",
        "required": true,
        "oneOf": [
          {
            "title": "None",
            "enum": [
              "none"
            ]
          },
          {
            "title": "Hashed Token",
            "enum": [
              "hashedToken"
            ]
          },
          {
            "title": "Encrypted Token",
            "enum": [
              "encryptedToken"
            ]
          }
        ]
      },
      "latch": {
        "description": "Expose a second <i>Lock Mechanism</i> service to unlatch a Smart Lock.",
        "type": "boolean"
      },
      "port": {
        "description": "Port to use for webserver receiving Nuki bridge notifications.  Default: random.",
        "type": "integer",
        "maximum": 65535
      },
      "openerResetTimeout": {
        "description": "The timeout in milliseconds to wait before resetting the Opener to locked.  Default: 500.  Set to 0 to keep the Opener unlocked.",
        "type": "integer",
        "minimum": 0,
        "maximum": 2000
      },
      "removeStaleAccessories": {
        "description": "Remove stale accessories, whose devices are no longer exposed by a Nuki bridge.",
        "type": "boolean"
      },
      "timeout": {
        "description": "The timeout in seconds to wait for a response from a Nuki bridge.  Default: 15.",
        "type": "integer",
        "minimum": 1,
        "maximum": 60
      }
    }
  },
  "form": [
    "name",
    "latch",
    {
      "nodescription": true,
      "notitle": true,
      "key": "bridges",
      "type": "array",
      "items": [
        {
          "type": "div",
          "displayFlex": true,
          "items": [
            {
              "key": "bridges[].bridgeId",
              "required": true,
              "flex": "1 1 50px"
            },
            {
              "key": "bridges[].host",
              "required": true,
              "flex": "1 1 50px"
            }
          ]
        }
      ]
    },
{
      "type": "fieldset",
      "expandable": true,
      "title": "Advanced Settings",
      "description": "Don't change these, unless you understand what you're doing.",
      "items": [
        {
          "nodescription": true,
          "notitle": true,
          "key": "devices",
          "type": "array",
          "items": [
            {
              "type": "div",
              "displayFlex": true,
              "items": [
                {
                  "key": "devices[]",
                  "required": true,
                  "flex": "1 1 50px"
                }
              ]
            }
          ]
        },
        "encryption",
        "openerResetTimeout",
        "port",
        "removeStaleAccessories",
        "timeout"
      ]
    }
  ]
}
