{
  "pluginAlias": "August",
  "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-august/latest/branding/Homebridge_x_August.png'></p>\n\nThe **August** plugin allows you to control August Devices. \n\nTo get started link your August Account.\n\n1. Input your August E-mail/Phone Number into the August Account Info.\n\n2.Restart Homebridge to receive an August Validate Code.\n\n3. Input your Validate Code into the August Account Info.\n\n4. Finally Restart Homebridge.",
  "footerDisplay": "Please raise any issues on our [project page](https://github.com/homebridge-plugins/homebridge-august/issues).\n\nIf you would like to have other features, please open a [feature request](https://github.com/homebridge-plugins/homebridge-august/issues/new/choose).",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "title": "Name",
        "default": "August"
      },
      "credentials": {
        "type": "object",
        "properties": {
          "augustId": {
            "title": "August ID",
            "type": "string",
            "placeholder": "E-mail or Phone Number",
            "x-schema-form": {
              "type": "username"
            }
          },
          "password": {
            "title": "August Password",
            "type": "string",
            "placeholder": "Password",
            "x-schema-form": {
              "type": "password"
            },
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId);"
            }
          },
          "countryCode": {
            "type": "string",
            "title": "Country Code",
            "placeholder": "US",
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password);"
            },
            "pattern": "^[A-Z]{2}$",
            "patternErrorMessage": "Must be a valid country code",
            "minLength": 2,
            "maxLength": 2,
            "validation": "countryCode",
            "enum": [
              "US",
              "CA",
              "GB",
              "DE",
              "AT",
              "IE",
              "ES",
              "FR",
              "BE",
              "NL",
              "LU",
              "CH",
              "IT",
              "JP",
              "CN",
              "SG",
              "AU",
              "NZ",
              "HK",
              "KR",
              "TW",
              "MX",
              "BR",
              "AR",
              "CL",
              "CO",
              "PE",
              "UY",
              "CR",
              "EC",
              "SV",
              "GT",
              "HN",
              "NI",
              "PA",
              "PY",
              "PR",
              "VE",
              "IN",
              "AE",
              "QA",
              "SA",
              "KW",
              "BH",
              "OM",
              "EG",
              "ZA",
              "RU",
              "TR",
              "IL",
              "DK",
              "SE",
              "NO",
              "FI",
              "PL",
              "CZ",
              "SK",
              "PT",
              "GR",
              "HU",
              "RO",
              "BG",
              "HR",
              "SI",
              "RS",
              "LV",
              "LT",
              "EE",
              "IS",
              "MT",
              "CY"
            ],
            "x-schema-form": {
              "type": "select"
            }
          },
          "brand": {
            "title": "Account Brand",
            "type": "string",
            "default": "august",
            "description": "The app your account belongs to. Note: Yale Home accounts (common outside North America) can no longer sign in — Yale has switched off password login on its servers and requires a partner-only OAuth sign-in. Check if your lock supports native HomeKit instead.",
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password);"
            },
            "oneOf": [
              {
                "title": "August",
                "enum": [
                  "august"
                ]
              },
              {
                "title": "Yale Access",
                "enum": [
                  "yale_access"
                ]
              },
              {
                "title": "Yale Home",
                "enum": [
                  "yale_home"
                ]
              },
              {
                "title": "Yale Global",
                "enum": [
                  "yale_global"
                ]
              },
              {
                "title": "Yale August",
                "enum": [
                  "yale_august"
                ]
              }
            ],
            "x-schema-form": {
              "type": "select"
            }
          },
          "apiKey": {
            "type": "string",
            "title": "apiKey",
            "placeholder": "7f0dd80d-8531-4f8d-ba9b-3b0c9e6f8e4b",
            "x-schema-form": {
              "type": "apiKey"
            },
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password && model.credentials.countryCode);"
            }
          },
          "pnSubKey": {
            "type": "string",
            "title": "pnSubKey",
            "placeholder": "sub-c-91d9b2e2-8b48-11e9-8b87-0619f8945a4f",
            "x-schema-form": {
              "type": "pnSubKey"
            },
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password && model.credentials.countryCode);"
            }
          },
          "installId": {
            "title": "Install ID",
            "type": "string",
            "placeholder": "00000000-0000-0000-0000-000000000000",
            "x-schema-form": {
              "type": "installId"
            },
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password && model.credentials.countryCode && !model.credentials.isValidated);"
            },
            "pattern": "^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$",
            "patternErrorMessage": "Must be a valid UUID",
            "minLength": 36,
            "maxLength": 36,
            "validation": "uuid",
            "notitle": true,
            "description": "This is a unique identifier for your device. It is generated by the plugin and is not configurable."
          },
          "validateCode": {
            "title": "August  Verification Code",
            "type": "string",
            "x-schema-form": {
              "type": "one-time-code"
            },
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password && model.credentials.countryCode && !model.credentials.isValidated);"
            },
            "pattern": "^[0-9]{6}$",
            "patternErrorMessage": "Must be a valid verification code",
            "minLength": 6,
            "maxLength": 6,
            "validation": "verificationCode",
            "description": "This is a unique verification code that is sent to your Email or Phone on your August account. It is generated by the plugin."
          },
          "isValidated": {
            "title": "Validated",
            "type": "boolean",
            "default": false,
            "condition": {
              "functionBody": "return (model.credentials && model.credentials.augustId && model.credentials.password && model.credentials.countryCode);"
            },
            "description": "This indicates if the verification code has been validated. It is generated by the plugin and is not configurable.",
            "x-schema-form": {
              "type": "checkbox"
            }
          },
          "notice": {
            "title": "Notice",
            "type": "string",
            "default": "Keep your tokens a secret!"
          }
        },
        "required": [
          "augustId",
          "password",
          "countryCode",
          "validateCode",
          "notice"
        ]
      },
      "options": {
        "type": "object",
        "properties": {
          "devices": {
            "type": "array",
            "items": {
              "title": "Devices",
              "type": "object",
              "properties": {
                "lockId": {
                  "title": "Lock ID",
                  "type": "string",
                  "placeholder": "TSSQ97FRDMX7TPGU3Z2HWNRDPQXJ9YSM"
                },
                "configLockName": {
                  "title": "Device Name",
                  "type": "string",
                  "placeholder": "August",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId);"
                  }
                },
                "hide_device": {
                  "title": "Hide Device",
                  "type": "boolean",
                  "description": "If true then devices that are reported as offline will be shown as off in HomeKit.",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId);"
                  }
                },
                "lock": {
                  "type": "object",
                  "properties": {
                    "hide_lock": {
                      "title": "Hide Lock",
                      "description": "Allows you to hide the lock and only show the Contact Sensor. Useful for locks that already support HomeKit.",
                      "type": "boolean",
                      "condition": {
                        "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                      }
                    },
                    "hide_contactsensor": {
                      "title": "Hide Lock's Contact Sensor",
                      "type": "boolean",
                      "condition": {
                        "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                      }
                    }
                  }
                },
                "overrideHomeKitEnabled": {
                  "title": "Override HomeKit Enabled",
                  "type": "boolean",
                  "description": "By default, devices tht are HomeKit enabled will be shown in HomeKit. If you want to override this, set this to true and the device will display in the Home app.",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                },
                "firmware": {
                  "title": "Firmware Override",
                  "type": "string",
                  "placeholder": "1.2.8",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                },
                "refreshRate": {
                  "title": "Device Refresh Rate",
                  "type": "number",
                  "maximum": 2073600,
                  "placeholder": 300,
                  "description": "Indicates the number of seconds between polls of August API.",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                },
                "updateRate": {
                  "title": "Device Update Rate",
                  "type": "number",
                  "placeholder": 1,
                  "description": "Indicates the number of seconds between pushes to August API.",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                },
                "pushRate": {
                  "title": "Device Push Rate",
                  "type": "number",
                  "placeholder": 1,
                  "description": "Indicates the number of seconds between pushes to August API.",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                },
                "external": {
                  "title": "External Accessory",
                  "type": "boolean",
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                },
                "logging": {
                  "title": "Device Logging Level Override",
                  "description": "Overrides the plugin logging level for this device only. None turns off all messages from this plugin. Standard shows normal activity, warnings and errors. Debug adds detailed messages, and is what to use when reporting a problem. Default behaves the same as Standard.",
                  "type": "string",
                  "default": "",
                  "oneOf": [
                    {
                      "title": "Default (same as Standard)",
                      "enum": [
                        ""
                      ]
                    },
                    {
                      "title": "None",
                      "enum": [
                        "none"
                      ]
                    },
                    {
                      "title": "Standard",
                      "enum": [
                        "standard"
                      ]
                    },
                    {
                      "title": "Debug",
                      "enum": [
                        "debug"
                      ]
                    }
                  ],
                  "condition": {
                    "functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].lockId && !model.options.devices[arrayIndices].hide_device);"
                  }
                }
              },
              "required": [
                "lockId",
                "configLockName",
                "logging"
              ]
            },
            "uniqueItems": true
          },
          "excludeLockIds": {
            "title": "Exclude Lock IDs",
            "type": "array",
            "items": {
              "title": "Lock ID",
              "type": "string",
              "placeholder": "TSSQ97FRDMX7TPGU3Z2HWNRDPQXJ9YSM"
            },
            "description": "List of Lock IDs to exclude from HomeKit. Locks with these IDs will not be discovered or registered."
          },
          "refreshRate": {
            "title": "Refresh Rate",
            "type": "number",
            "maximum": 2073600,
            "placeholder": 360,
            "description": "Indicates the number of seconds between polls of August API."
          },
          "pushRate": {
            "title": "Push Rate",
            "type": "number",
            "placeholder": 1,
            "description": "Indicates the number of seconds between pushes to August API."
          },
          "logging": {
            "title": "Plugin Logging Level",
            "description": "None turns off all messages from this plugin. Standard shows normal activity, warnings and errors. Debug adds detailed messages, and is what to use when reporting a problem. Default behaves the same as Standard.",
            "type": "string",
            "default": "",
            "oneOf": [
              {
                "title": "Default (same as Standard)",
                "enum": [
                  ""
                ]
              },
              {
                "title": "None",
                "enum": [
                  "none"
                ]
              },
              {
                "title": "Standard",
                "enum": [
                  "standard"
                ]
              },
              {
                "title": "Debug",
                "enum": [
                  "debug"
                ]
              }
            ]
          },
          "allowInvalidCharacters": {
            "title": "Allow Invalid Characters",
            "type": "boolean",
            "description": "If true, invalid characters will be allowed in the device name."
          },
          "disableCountryCodeNormalization": {
            "title": "Disable Country Code Normalization",
            "type": "boolean",
            "description": "If true, country code normalization will be disabled. Note: Some country codes (like CA) may cause 403 errors if not normalized to US.",
            "default": false
          },
          "disableMatter": {
            "title": "Disable Matter",
            "type": "boolean",
            "description": "If true, Matter support will be disabled and the plugin will use the legacy HAP protocol instead, even when Homebridge Matter is available.",
            "default": false
          }
        },
        "required": [
          "logging"
        ]
      }
    },
    "required": [
      "name",
      "credentials"
    ]
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "August Account Info",
      "expandable": true,
      "expanded": false,
      "items": [
        "credentials.augustId",
        "credentials.password",
        "credentials.brand",
        "credentials.validateCode",
        {
          "type": "fieldset",
          "title": "Advanced August Account Settings",
          "expandable": true,
          "expanded": false,
          "items": [
            "credentials.countryCode",
            "credentials.isValidated",
            "credentials.installId"
          ]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "August Device Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "key": "options.devices",
          "notitle": false,
          "type": "tabarray",
          "title": "{{ value.configLockName || value.lockId || 'New Lock Device' }}",
          "expandable": true,
          "expanded": false,
          "orderable": false,
          "items": [
            "options.devices[].configLockName",
            "options.devices[].lockId",
            "options.devices[].hide_device",
            "options.devices[].overrideHomeKitEnabled",
            "options.devices[].lock.hide_lock",
            "options.devices[].lock.hide_contactsensor",
            "options.devices[].firmware",
            {
              "key": "options.devices[].refreshRate",
              "description": "<em class='primary-text'>Specifies the interval, in seconds, for retrieving the latest device status from the August API. This interval applies only to this specific device. Set to </em>0<em class='primary-text'> if you would like to just receive updates from the August API</em>"
            },
            {
              "key": "options.devices[].pushRate",
              "description": "<em class='primary-text'>Specifies the interval, in seconds, between pushes to the August API for this specific device.</em>"
            },
            "options.devices[].external",
            "options.devices[].logging"
          ]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Advanced Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "key": "options.refreshRate",
          "description": "<em class='primary-text'>Specifies the interval, in seconds, for retrieving the latest device status from the August API.</em>"
        },
        {
          "key": "options.pushRate",
          "description": "<em class='primary-text'>Specifies the interval, in seconds, between pushes to the August API.</em>"
        },
        "options.logging",
        {
          "key": "options.excludeLockIds",
          "type": "array",
          "title": "Exclude Lock IDs",
          "expandable": true,
          "expanded": false,
          "orderable": false,
          "items": [
            "options.excludeLockIds[]"
          ]
        },
        "options.allowInvalidCharacters",
        "options.disableCountryCodeNormalization",
        "options.disableMatter"
      ]
    }
  ]
}
