{
  "pluginAlias": "Alexa",
  "pluginType": "platform",
  "singular": true,
  "headerDisplay": "<h1><p align='center'>Allow your Amazon Alexa to control your homebridge devices</H1></p><h1><p align='center'><img src='https://raw.githubusercontent.com/NorthernMan54/homebridge-alexa/main/docs/README_Image.001.jpeg' width='80%' style='vertical-align:middle'></p></h1> <br><b>To setup the service:</b><br><br>1 - First <b>create</b> an account on <a href='https://www.homebridge.ca/'>https://www.homebridge.ca/</a>.  <br>2 - Then <b>enter</b> the username and password for your account <b>below</b>.  <br>3 - <b>Save</b> the settings and <b>restart</b> homebridge.  <br>4 - In the Amazon Alexa Application on your smart phone, <b>search</b> for the Homebridge Skill and enable it.  When you enable the skill, it will take you to the <b>https://www.homebridge.ca/</b> website to <b>enable</b> and link the skill to the plugin.  <br>5 - You can now ask Alexa to <b>`discover devices`</b> and it should discover your homebridge devices.<br><br>Detailed setup instructions are available <a href='https://github.com/NorthernMan54/homebridge-alexa/blob/master/Installation.md#setup-instructions'>here</a>.<br>",
  "footerDisplay": "Homebridge Alexa Skill: https://www.amazon.com/Northern-Man-54-Homebridge/dp/B07B9QMTFQ",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "title": "<b>Name</b>",
        "type": "string",
        "required": true,
        "default": "Alexa",
        "description": "Plugin name as displayed in the Homebridge log"
      },
      "username": {
        "title": "<b>Username</b>",
        "type": "string",
        "required": true,
        "description": "Username for https://www.homebridge.ca/"
      },
      "password": {
        "title": "<b>Password</b>",
        "type": "string",
        "required": true,
        "description": "Password for https://www.homebridge.ca/"
      },
      "pin": {
        "title": "<b>Homebridge Pin</b>",
        "type": "string",
        "placeholder": "031-45-154",
        "description": "This needs to match the Homebridge pin set in your config.json file"
      },
      "routines": {
        "title": "<b>Routines</b>",
        "type": "boolean",
        "placeholder": false,
        "description": "Enables passing of Motion and Contact sensor events to Alexa. For use in the Alexa app to create Routines triggered by these sensors."
      },
      "blind": {
        "title": "<b>Blind</b>",
        "type": "boolean",
        "placeholder": false,
        "description": "Enables natural wording for opening and closing blinds, and window coverings.  Not supported in all countries.  Defaults to false"
      },
      "door": {
        "title": "<b>Door</b>",
        "type": "boolean",
        "placeholder": false,
        "description": "Enables natural wording for opening and closing garage doors.  Not supported in all countries.  Please note that opening a garage door requires setting a voice pin within the Alexa app.  Defaults to false"
      },
      "debug": {
        "title": "<b>Debug</b>",
        "type": "boolean",
        "placeholder": false,
        "description": "Enable debug level logging to assist in problem investigation."
      },
      "beta": {
        "title": "<b>beta</b>",
        "type": "boolean",
        "placeholder": false,
        "description": "Enable beta test environment.  Only available by invitation."
      },
      "deviceCleanup": {
        "title": "<b>Cleanup of Not Responding Devices</b>",
        "type": "boolean",
        "default": true,
        "description": "Enables cleanup of devices that are not responding.  This will remove devices from Alexa that are not responding.  Defaults to true."
      },
      "refresh": {
        "title": "<b>Accessory Cache Refresh Interval</b>",
        "type": "integer",
        "default": 900,
        "description": "Frequency of refreshes of the homebridge accessory cache, in seconds. Defaults to 900 Seconds ( 15 minutes ). This is the interval before new devices/homebridge instances are discovered.  This should never require changing, unless you are frequently changing your homebridge configuration without restarting the plugin.",
        "minimum": 120,
        "maximum": 86400
      },
      "keepalive": {
        "title": "<b>Cloud Server Connection Keepalive</b>",
        "type": "integer",
        "default": "5",
        "description": "Frequency of keepalive messages to cloud server, in minutes. Defaults to 5 minutes.  Do not change from default unless requested as part of problem investigation.",
        "minimum": 1,
        "maximum": 59,
        "condition": {
          "functionBody": "return model.CloudTransport !== 'wss';"
        }
      },
      "mergeServiceName": {
        "title": "<b>Alternate device naming approach</b>",
        "type": "boolean",
        "description": "This is an alternate device naming approach, which combines the internal HomeKit names for a device.  It may resolve duplicate device name issues. Do not enable on an existing implementation, as you will lose control of your existing devices.",
        "placeholder": false
      },
      "thermostatTurnOn": {
        "title": "<b>Thermostat Turn On Behaviour</b>",
        "description": "Set Thermostat `Turn On` Behaviour to either Heat, Cool or Auto when Alexa is asked to turn on a Thermostat. Defaults to doing nothing and saying `That command does not work on device ...`.",
        "type": "integer",
        "oneOf": [
          {
            "title": "Heat",
            "enum": [
              1
            ]
          },
          {
            "title": "Cool",
            "enum": [
              2
            ]
          },
          {
            "title": "Auto",
            "enum": [
              3
            ]
          }
        ]
      },
      "CloudTransport": {
        "title": "<b>Cloud Server Connection Transport</b>",
        "description": "Transport options for cloud server connection. MQTTS - this is the recommended setting. MQTT - this is the original/legacy option. WSS - this is the an alternative transport option.",
        "type": "string",
        "default": "mqtts",
        "required": true,
        "oneOf": [
          {
            "title": "MQTTS",
            "enum": [
              "mqtts"
            ]
          },
          {
            "title": "WSS",
            "enum": [
              "wss"
            ]
          },
          {
            "title": "MQTT",
            "enum": [
              "mqtt"
            ]
          }
        ]
      },
      "filter": {
        "title": "<b>Homebridge Instance Filter</b>",
        "type": "string",
        "placeholder": "eg. 192.168.1.122:51826",
        "description": "Limits accessories shared with Alexa to particular homebridge instances. Uses ip address and port of homebridge instance, eg. '192.168.1.122:51826' or '192.168.1.11:51551, 192.168.1.11:46047'.",
        "pattern": "^(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}:\\d{1,5})(,\\s*\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}:\\d{1,5})*$"
      },
      "deviceListHandling": {
        "title": "<b>Device List</b>",
        "type": "string",
        "description": "Allows filtering of devices by name. You can either allow or ignore a list of device names.",
        "default": "none",
        "required": true,
        "oneOf": [
          {
            "title": "None",
            "enum": [
              "none"
            ]
          },
          {
            "title": "Allow devices",
            "enum": [
              "allow"
            ]
          },
          {
            "title": "Ignore devices",
            "enum": [
              "deny"
            ]
          }
        ]
      },
      "deviceList": {
        "title": "Devices to be allowed or denied",
        "type": "array",
        "items": {
          "type": "string"
        },
        "condition": {
          "functionBody": "if (model.deviceListHandling === 'allow' || model.deviceListHandling === 'deny') { return true } else { return false };"
        }
      },
      "combine": {
        "type": "array",
        "items": {
          "title": "Combine",
          "type": "object",
          "properties": {
            "into": {
              "title": "Into",
              "type": "string"
            },
            "from": {
              "title": "From",
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "speakers": {
        "title": "Speakers",
        "type": "array",
        "items": {
          "title": "Speaker",
          "type": "object",
          "properties": {
            "manufacturer": {
              "title": "Manufacturer",
              "type": "string"
            },
            "name": {
              "title": "Name",
              "type": "string"
            }
          }
        }
      },
      "enhancedSkip": {
        "title": "<b>For 'appletv-enhanced', enable skip</b>",
        "type": "boolean",
        "placeholder": false,
        "description": "This option will change the behaviour of the next or skip command of the 'appletv-enhanced' plugin, from skip to select.  This will enable the wording 'Alexa tv skip' to press the select button on the Apple TV remote.  This is useful for skipping adds on YouTube."
      }
    }
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "Required Settings",
      "items": [
        {
          "type": "flex",
          "flex-flow": "row wrap",
          "items": [
            "username",
            {
              "key": "password",
              "type": "password"
            }
          ]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Optional Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        "pin",
        "routines",
        "deviceCleanup",
        "debug",
        "thermostatTurnOn",
        "enhancedSkip",
        "deviceListHandling",
        {
          "key": "deviceList",
          "type": "array",
          "items": {
            "title": "DeviceName",
            "description": "Name of the device you want to allow or ignore",
            "type": "string"
          },
          "condition": {
            "functionBody": "return model.deviceListHandling !== 'none';"
          }
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Advanced Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        "CloudTransport",
        "keepalive",
        "refresh",
        "filter",
        "mergeServiceName",
        "blind",
        "door"
      ]
    },
    {
      "type": "fieldset",
      "title": "Speakers",
      "description": "Devices to configure as speakers as HomeKit currently does not have a Speaker service.",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "notitle": true,
          "key": "speakers",
          "type": "array",
          "items": [
            {
              "type": "div",
              "displayFlex": true,
              "flex-direction": "row",
              "items": [
                {
                  "key": "speakers[].manufacturer",
                  "flex": "1 1 50px",
                  "notitle": true,
                  "placeholder": "Manufacturer"
                },
                {
                  "key": "speakers[].name",
                  "flex": "4 4 200px",
                  "notitle": true,
                  "placeholder": "Name"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Combine Accessories",
      "description": "Combine disparate accessories into one common device.",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "notitle": true,
          "key": "combine",
          "type": "array",
          "items": [
            {
              "type": "div",
              "items": [
                {
                  "key": "combine[].into",
                  "title": "Into",
                  "placeholder": "Target Accessory Name"
                },
                {
                  "key": "combine[].from",
                  "notitle": true,
                  "items": [
                    {
                      "title": "From",
                      "key": "combine[].from[]",
                      "placeholder": "Source Accessory Name"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}