{
  "pluginAlias": "Deebot",
  "pluginType": "platform",
  "singular": true,
  "strictValidation": true,
  "customUi": true,
  "customUiPath": "./lib/homebridge-ui",
  "headerDisplay": "<p align=\"center\"><img width=\"60%\" src=\"https://user-images.githubusercontent.com/43026681/101321841-f0eb5280-385d-11eb-8dd4-f57113f6e078.png\"></p><p align=\"center\">For help and support please visit our <a href=\"https://github.com/homebridge-plugins/homebridge-ecovacs/wiki\">GitHub Wiki</a>. We hope you find this plugin useful!</p>",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "title": "Plugin Name",
        "type": "string",
        "default": "Deebot"
      },
      "useYeedi": {
        "title": "Use Yeedi Login",
        "type": "boolean",
        "description": "Enable this for Yeedi login instead of Ecovacs."
      },
      "countryCode": {
        "title": "Country Code",
        "description": "Two-letter country code which you can find <a href=\"https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Country-Codes\" target=\"_blank\">here</a>.",
        "type": "string",
        "required": true
      },
      "username": {
        "title": "Ecovacs/Yeedi Username",
        "required": true,
        "type": "string",
        "description": "Your username, if your account is based in China you should use your Ecovacs ID."
      },
      "password": {
        "title": "Ecovacs/Yeedi Password",
        "required": true,
        "type": "string",
        "description": "Your password, can also be a base64 encoded version of your password."
      },
      "disableDeviceLogging": {
        "type": "boolean",
        "title": "Disable Device Logging",
        "description": "Global logging setting for accessory status changes. If true then accessory status changes will not be logged."
      },
      "devices": {
        "title": "Device Settings",
        "description": "Optional settings for your devices.",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "label": {
              "title": "Label",
              "type": "string",
              "description": "This setting has no effect except to help identify this device."
            },
            "deviceId": {
              "title": "Device ID",
              "type": "string",
              "description": "Ecovacs Device ID of the device these settings apply to, can be of format E2000000000000000000 or 11111111-aaaa-bbbb-2222-cccccccccccc."
            },
            "ignoreDevice": {
              "type": "boolean",
              "title": "Hide From HomeKit",
              "description": "If true, this accessory will be removed and ignored from HomeKit.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0);"
              }
            },
            "pollInterval": {
              "title": "Polling Interval",
              "type": "integer",
              "placeholder": 120,
              "description": "An interval (in seconds) in which this device will refresh with Ecovacs. Set to 0 to disable, otherwise must be 30 or more."
            },
            "hideMotionSensor": {
              "title": "Hide Motion Sensor",
              "type": "boolean",
              "description": "If true, the motion sensor for device alerts will be hidden.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "motionDuration": {
              "title": "Alert Notification Time",
              "type": "integer",
              "placeholder": 30,
              "minimum": 1,
              "description": "The length of time (in seconds) that the motion detector will be activated if your Deebot sends a message, needs help or has low battery (if enabled below). The message is viewable in the log. Must be 1 or more.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.hideMotionSensor && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "lowBattThreshold": {
              "title": "Low Battery Threshold",
              "type": "integer",
              "placeholder": 15,
              "minimum": 1,
              "description": "The battery percentage at which the plugin should display a low battery status. Leave blank to match the Deebot default of 15%. Must be 1 or more.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "showMotionLowBatt": {
              "title": "Low Battery Motion Sensor",
              "type": "boolean",
              "description": "If true, the motion sensor will activate when the Deebot's battery reaches the low battery threshold.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.hideMotionSensor && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "showBattHumidity": {
              "title": "Show (Humidity) Battery Sensor",
              "type": "boolean",
              "description": "If true, a humidity sensor showing the battery percentage will be shown.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "showAirDryingSwitch": {
              "title": "Show Air Drying Switch",
              "type": "string",
              "oneOf": [
                {
                  "title": "Presetting",
                  "enum": ["presetting"]
                },
                {
                  "title": "Yes",
                  "enum": ["yes"]
                },
                {
                  "title": "No",
                  "enum": ["no"]
                }
              ],
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "supportTrueDetect": {
              "title": "Support TrueDetect",
              "type": "boolean",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              }
            },
            "areaType1": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs1": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType1 == 'spotArea' );"
              }
            },
            "customAreaCoordinates1": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType1 == 'customArea' );"
              }
            },
            "areaNote1": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType1);"
              }
            },
            "areaType2": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs2": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType2 == 'spotArea' );"
              }
            },
            "customAreaCoordinates2": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType2 == 'customArea' );"
              }
            },
            "areaNote2": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType2);"
              }
            },
            "areaType3": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs3": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType3 == 'spotArea' );"
              }
            },
            "customAreaCoordinates3": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType3 == 'customArea' );"
              }
            },
            "areaNote3": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType3);"
              }
            },
            "areaType4": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs4": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType4 == 'spotArea' );"
              }
            },
            "customAreaCoordinates4": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType4 == 'customArea' );"
              }
            },
            "areaNote4": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType4);"
              }
            },
            "areaType5": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs5": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType5 == 'spotArea' );"
              }
            },
            "customAreaCoordinates5": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType5 == 'customArea' );"
              }
            },
            "areaNote5": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType5);"
              }
            },
            "areaType6": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs6": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType6 == 'spotArea' );"
              }
            },
            "customAreaCoordinates6": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType6 == 'customArea' );"
              }
            },
            "areaNote6": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType6);"
              }
            },
            "areaType7": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs7": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType7 == 'spotArea' );"
              }
            },
            "customAreaCoordinates7": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType7 == 'customArea' );"
              }
            },
            "areaNote7": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType7);"
              }
            },
            "areaType8": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs8": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType8 == 'spotArea' );"
              }
            },
            "customAreaCoordinates8": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType8 == 'customArea' );"
              }
            },
            "areaNote8": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType8);"
              }
            },
            "areaType9": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs9": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType9 == 'spotArea' );"
              }
            },
            "customAreaCoordinates9": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType9 == 'customArea' );"
              }
            },
            "areaNote9": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType9);"
              }
            },
            "areaType10": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs10": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType10 == 'spotArea' );"
              }
            },
            "customAreaCoordinates10": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType10 == 'customArea' );"
              }
            },
            "areaNote10": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType10);"
              }
            },
            "areaType11": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs11": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType11 == 'spotArea' );"
              }
            },
            "customAreaCoordinates11": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType11 == 'customArea' );"
              }
            },
            "areaNote11": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType11);"
              }
            },
            "areaType12": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs12": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType12 == 'spotArea' );"
              }
            },
            "customAreaCoordinates12": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType12 == 'customArea' );"
              }
            },
            "areaNote12": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType12);"
              }
            },
            "areaType13": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs13": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType13 == 'spotArea' );"
              }
            },
            "customAreaCoordinates13": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType13 == 'customArea' );"
              }
            },
            "areaNote13": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType13);"
              }
            },
            "areaType14": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs14": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType14 == 'spotArea' );"
              }
            },
            "customAreaCoordinates14": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType14 == 'customArea' );"
              }
            },
            "areaNote14": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType14);"
              }
            },
            "areaType15": {
              "title": "Area Type",
              "type": "string",
              "oneOf": [
                { "title": "Spot Area", "enum": ["spotArea"] },
                { "title": "Custom Area", "enum": ["customArea"] }
              ]
            },
            "spotAreaIDs15": {
              "title": "Spot Area ID(s)",
              "type": "string",
              "required": true,
              "description": "Enter a spot area ID or multiple IDs separated by a comma.",
              "pattern": "^([0-9]|[1-9][0-9]+|(([0-9],|[1-9][0-9]+,)+([0-9]|[1-9][0-9]+)))$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType15 == 'spotArea' );"
              }
            },
            "customAreaCoordinates15": {
              "title": "Custom Area Coordinates",
              "type": "string",
              "required": true,
              "description": "Enter custom area coordinates in the format 'x1,y1,x2,y2' (decimals separated by '.' and without the inverted comma).",
              "pattern": "^((0|-?[1-9][0-9]*)(\\.[0-9]+)?,){3}(0|-?[1-9][0-9]*)(\\.[0-9]+)?$",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType15 == 'customArea' );"
              }
            },
            "areaNote15": {
              "title": "Note",
              "type": "string",
              "description": "Enter a note for this predefined area.",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType15);"
              }
            }
          }
        }
      }
    }
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "Required Settings",
      "items": ["useYeedi", "countryCode", "username", "password"]
    },
    {
      "type": "fieldset",
      "title": "Optional Settings",
      "expandable": true,
      "items": ["disableDeviceLogging", "refreshTime"]
    },
    {
      "key": "devices",
      "title": "Device Settings",
      "description": "Optional settings for your devices.",
      "expandable": true,
      "add": "Add Another Device",
      "type": "array",
      "items": [
        {
          "type": "fieldset",
          "items": [
            "devices[].label",
            "devices[].deviceId",
            "devices[].ignoreDevice",
            "devices[].pollInterval",
            "devices[].hideMotionSensor",
            "devices[].motionDuration",
            "devices[].lowBattThreshold",
            "devices[].showMotionLowBatt",
            "devices[].showBattHumidity",
            "devices[].showAirDryingSwitch",
            "devices[].supportTrueDetect",
            {
              "expandable": true,
              "title": "Predefined Areas",
              "type": "fieldset",
              "condition": {
                "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
              },
              "description": "Create Eve app buttons for cleaning predefined 'Spot Areas' or 'Custom Areas'. <a href=\"https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Predefined-Areas\" target=\"_blank\">Read more →</a>",
              "items": [
                {
                  "expandable": false,
                  "title": "Area 1",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice);"
                  },
                  "items": [
                    "devices[].areaType1",
                    "devices[].spotAreaIDs1",
                    "devices[].customAreaCoordinates1",
                    "devices[].areaNote1"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 2",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType1);"
                  },
                  "items": [
                    "devices[].areaType2",
                    "devices[].spotAreaIDs2",
                    "devices[].customAreaCoordinates2",
                    "devices[].areaNote2"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 3",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType2);"
                  },
                  "items": [
                    "devices[].areaType3",
                    "devices[].spotAreaIDs3",
                    "devices[].customAreaCoordinates3",
                    "devices[].areaNote3"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 4",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType3);"
                  },
                  "items": [
                    "devices[].areaType4",
                    "devices[].spotAreaIDs4",
                    "devices[].customAreaCoordinates4",
                    "devices[].areaNote4"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 5",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType4);"
                  },
                  "items": [
                    "devices[].areaType5",
                    "devices[].spotAreaIDs5",
                    "devices[].customAreaCoordinates5",
                    "devices[].areaNote5"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 6",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType5);"
                  },
                  "items": [
                    "devices[].areaType6",
                    "devices[].spotAreaIDs6",
                    "devices[].customAreaCoordinates6",
                    "devices[].areaNote6"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 7",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType6);"
                  },
                  "items": [
                    "devices[].areaType7",
                    "devices[].spotAreaIDs7",
                    "devices[].customAreaCoordinates7",
                    "devices[].areaNote7"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 8",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType7);"
                  },
                  "items": [
                    "devices[].areaType8",
                    "devices[].spotAreaIDs8",
                    "devices[].customAreaCoordinates8",
                    "devices[].areaNote8"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 9",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType8);"
                  },
                  "items": [
                    "devices[].areaType9",
                    "devices[].spotAreaIDs9",
                    "devices[].customAreaCoordinates9",
                    "devices[].areaNote9"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 10",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType9);"
                  },
                  "items": [
                    "devices[].areaType10",
                    "devices[].spotAreaIDs10",
                    "devices[].customAreaCoordinates10",
                    "devices[].areaNote10"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 11",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType10);"
                  },
                  "items": [
                    "devices[].areaType11",
                    "devices[].spotAreaIDs11",
                    "devices[].customAreaCoordinates11",
                    "devices[].areaNote11"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 12",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType11);"
                  },
                  "items": [
                    "devices[].areaType12",
                    "devices[].spotAreaIDs12",
                    "devices[].customAreaCoordinates12",
                    "devices[].areaNote12"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 13",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType12);"
                  },
                  "items": [
                    "devices[].areaType13",
                    "devices[].spotAreaIDs13",
                    "devices[].customAreaCoordinates13",
                    "devices[].areaNote13"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 14",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType13);"
                  },
                  "items": [
                    "devices[].areaType14",
                    "devices[].spotAreaIDs14",
                    "devices[].customAreaCoordinates14",
                    "devices[].areaNote14"
                  ]
                },
                {
                  "expandable": false,
                  "title": "Area 15",
                  "type": "fieldset",
                  "condition": {
                    "functionBody": "return (model?.devices?.[arrayIndices]?.deviceId?.length > 0 && !model?.devices?.[arrayIndices]?.ignoreDevice && model?.devices?.[arrayIndices]?.areaType14);"
                  },
                  "items": [
                    "devices[].areaType15",
                    "devices[].spotAreaIDs15",
                    "devices[].customAreaCoordinates15",
                    "devices[].areaNote15"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
