{
  "pluginAlias": "RoborockVacuumPlatform",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "customUiPath": "./homebridge-ui",
  "schema": {
    "type": "object",
    "properties": {
      "email": {
        "title": "Email",
        "type": "string",
        "format": "email",
        "description": "Roborock account email"
      },
      "password": {
        "title": "Password",
        "type": "string",
        "placeholder": "Password",
        "description": "Roborock account password"
      },
      "encryptedToken": {
        "title": "Encrypted Token",
        "type": "string",
        "description": "Encrypted Roborock session data (managed by the UI)",
        "readOnly": true
      },
      "skipDevices": {
        "title": "Skipped Device IDs",
        "type": "string",
        "description": "Roborock device IDs to exclude from HomeKit."
      },
      "matterDevices": {
        "title": "Matter Device IDs",
        "type": "string",
        "description": "Roborock device IDs to publish over Matter instead of HAP. Requires Homebridge 2.x with Matter enabled; ignored otherwise."
      },
      "matterSceneDevices": {
        "title": "Matter Scene Button Device IDs",
        "type": "string",
        "description": "Matter device IDs whose Roborock scenes are bridged as Matter buttons. When omitted, scene buttons are enabled for every Matter device."
      },
      "baseURL": {
        "type": "string",
        "default": "https://usiot.roborock.com",
        "description": "Roborock API endpoint: https://usiot.roborock.com (US), https://euiot.roborock.com (EU), https://cniot.roborock.com (CN), https://api.roborock.com (Asia)"
      },
      "language": {
        "title": "Language",
        "type": "string",
        "default": "en",
        "description": "Language for device-provided switch names (e.g. the dock mop-wash switch). Changing it only renames accessories after a restart — no re-pairing or room re-selection is required.",
        "oneOf": [
          { "title": "English", "enum": ["en"] },
          { "title": "Deutsch", "enum": ["de"] },
          { "title": "Español", "enum": ["es"] },
          { "title": "Français", "enum": ["fr"] },
          { "title": "Italiano", "enum": ["it"] },
          { "title": "Nederlands", "enum": ["nl"] },
          { "title": "Polski", "enum": ["pl"] },
          { "title": "Português", "enum": ["pt"] },
          { "title": "Русский", "enum": ["ru"] },
          { "title": "Українська", "enum": ["uk"] },
          { "title": "简体中文", "enum": ["zh-cn"] },
          { "title": "繁體中文", "enum": ["zh-tw"] }
        ]
      },
      "debugMode": {
        "title": "Debug Mode",
        "description": "When enabled, debug messages will be written to the log.",
        "type": "boolean",
        "default": false
      },
      "currentRoomMqtt": {
        "title": "Current Room → MQTT",
        "type": "object",
        "description": "Publish the room each vacuum is currently cleaning to a local MQTT broker (telemetry only; not exposed to HomeKit). Off by default.",
        "properties": {
          "enabled": {
            "title": "Enabled",
            "type": "boolean",
            "default": false,
            "description": "Publish the current cleaning room to MQTT."
          },
          "brokerUrl": {
            "title": "Broker URL",
            "type": "string",
            "default": "mqtt://127.0.0.1:1883",
            "description": "MQTT broker URL."
          },
          "topic": {
            "title": "Topic Template",
            "type": "string",
            "default": "homebridge/roborock/{duid}/current_room",
            "description": "Topic to publish the retained current-room JSON to. Supports {duid} and {name} tokens; if neither is present, /{duid} is appended automatically so multiple vacuums don't collide."
          },
          "cleaningPollSeconds": {
            "title": "Cleaning Poll Interval (s)",
            "type": "integer",
            "default": 10,
            "minimum": 5,
            "description": "How often to poll status while actively cleaning, to catch room changes."
          }
        }
      }
    },
    "required": ["email"]
  }
}
