{
  "pluginAlias": "SmartHQ",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "customUiPath": "./dist/homebridge-ui",
  "headerDisplay": "<p align='center'><img width='250px' src='https://raw.githubusercontent.com/homebridge-plugins/homebridge-smarthq/latest/branding/Homebridge_x_SmartHQ.svg'></p>\n\nThe **Homebridge SmartHQ** plugin allows you to interact with SmartHQ devices from HomeKit and Siri.",
  "footerDisplay": "Your SmartHQ accont was linked. Please raise any issues on our [project page](https://github.com/homebridge-plugins/homebridge-smarthq/issues).\n\nIf you would like to have other features, fill out [Feature Request Form](https://github.com/homebridge-plugins/homebridge-smarthq/issues/new?assignees=&labels=&template=feature_request.md).",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "title": "Name",
        "default": "SmartHQ",
        "required": true
      },
      "credentials": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "title": "Username",
            "placeholder": "apple@icloud.com",
            "format": "email"
          },
          "password": {
            "type": "string",
            "title": "Password",
            "format": "password",
            "placeholder": "***************",
            "x-schema-form": {
              "type": "password"
            }
          },
          "notice": {
            "title": "Notice",
            "type": "string",
            "default": "Keep your username and password a secret!"
          }
        },
        "required": [
          "email",
          "password"
        ]
      },
      "devices": {
        "type": "array",
        "items": {
          "title": "Devices",
          "type": "object",
          "properties": {
            "configDeviceName": {
              "title": "Device Name",
              "type": "string",
              "placeholder": "Dishwasher",
              "description": "This is the name that will be used to identify the device in HomeKit."
            },
            "applianceId": {
              "title": "Application ID",
              "type": "string",
              "placeholder": "FCB97E120A84",
              "description": "This is devices unique applicationId."
            },
            "hide_device": {
              "title": "Hide Device",
              "type": "boolean",
              "default": false,
              "description": "If enabled, the device will not be added to HomeKit.",
              "condition": {
                "functionBody": "return (model.devices && model.devices[arrayIndices].applianceId);"
              }
            },
            "firmware": {
              "title": "Firmware Override",
              "type": "string",
              "placeholder": "1.2.8",
              "condition": {
                "functionBody": "return (model.devices && model.devices[arrayIndices].applianceId && !model.options.devices[arrayIndices].hide_device);"
              }
            },
            "external": {
              "title": "External Device",
              "type": "boolean",
              "default": false,
              "description": "If enabled, the device will be exposed to HomeKit as an external device.",
              "condition": {
                "functionBody": "return (model.devices && model.devices[arrayIndices].applianceId && !model.options.devices[arrayIndices].hide_device);"
              }
            },
            "refreshRate": {
              "title": "Device Refresh Rate",
              "type": "number",
              "minimum": 1800,
              "placeholder": 1800,
              "description": "Indicates the number of seconds between polls of the SmartHQ service.",
              "condition": {
                "functionBody": "return (model.devices && model.devices[arrayIndices].applianceId && !model.options.devices[arrayIndices].hide_device);"
              }
            },
            "logging": {
              "title": "Device Logging Override Setting",
              "type": "string",
              "required": true,
              "default": "",
              "oneOf": [
                {
                  "title": "Default Logging",
                  "enum": [
                    ""
                  ]
                },
                {
                  "title": "Standard Logging",
                  "enum": [
                    "standard"
                  ]
                },
                {
                  "title": "No Logging",
                  "enum": [
                    "none"
                  ]
                },
                {
                  "title": "Debug Logging",
                  "enum": [
                    "debug"
                  ]
                }
              ],
              "condition": {
                "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].applianceId && !model.options.devices[arrayIndices].hide_device);"
              }
            }
          },
          "required": [
            "id",
            "configDeviceName",
            "logging"
          ]
        }
      },
      "options": {
        "type": "object",
        "properties": {
          "refreshRate": {
            "title": "Refresh Rate",
            "type": "number",
            "minimum": 30,
            "placeholder": 120,
            "description": "Indicates the number of seconds between polls of the Meater service."
          },
          "updateRate": {
            "title": "Update Rate",
            "type": "number",
            "minimum": 30,
            "placeholder": 30,
            "description": "How frequently in seconds that HomeKit accessories are updated"
          },
          "homekitControllerNotificationsSecret": {
            "title": "Homekit Controller Notifications Secret",
            "type": "string",
            "placeholder": "xxxxxx",
            "default": "",
            "x-schema-form": {
              "type": "password"
            }
          },
          "logging": {
            "title": "Logging Setting",
            "type": "string",
            "required": true,
            "default": "",
            "oneOf": [
              {
                "title": "Default Logging",
                "enum": [
                  ""
                ]
              },
              {
                "title": "Standard Logging",
                "enum": [
                  "standard"
                ]
              },
              {
                "title": "No Logging",
                "enum": [
                  "none"
                ]
              },
              {
                "title": "Debug Logging",
                "enum": [
                  "debug"
                ]
              }
            ]
          }
        },
        "required": [
          "logging"
        ]
      }
    }
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "SmartHQ Account Info",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "type": "help",
          "helpvalue": "<h5></h5><em class='primary-text'>This is for Manual Setup Only.</em>"
        },
        "credentials.username",
        "credentials.password"
      ]
    },
    {
      "type": "fieldset",
      "title": "SmartHQ Device Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "key": "devices",
          "notitle": true,
          "type": "tabarray",
          "title": "{{ value.configDeviceName || value.applianceId || 'New SmartHQ Device' }}",
          "expandable": true,
          "expanded": false,
          "orderable": false,
          "items": [
            "devices[].configDeviceName",
            "devices[].applianceId",
            "devices[].hide_device",
            "devices[].firmware",
            "devices[].external",
            "devices[].refreshRate",
            "devices[].logging"
          ]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Advanced Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "type": "help",
          "helpvalue": "<h5>Refresh Rate</h5><em class='primary-text'>Refresh Rate indicates the number of seconds between polls of the SmartHQ service.</em>"
        },
        {
          "key": "options.refreshRate",
          "notitle": true
        },
        {
          "type": "help",
          "helpvalue": "<h5>Update Rate</h5><em class='primary-text'>Update Rate indicates how frequently in seconds HomeKit accessories are updated.</em>"
        },
        {
          "key": "options.updateRate",
          "notitle": true
        },
        {
          "type": "help",
          "helpvalue": "<h5>Homekit Controller Notifications Secret</h5><em class='primary-text'>For better notifications you can configure homekit controller, this is the secret under 'Devices & Secret'</em>"
        },
        {
          "key": "options.homekitControllerNotificationsSecret",
          "notitle": true
        },
        "options.logging"
      ]
    }
  ]
}