{
  "pluginAlias": "RoborockVacuumPlatform",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "customUiPath": "./homebridge-ui",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "title": "Name",
        "type": "string",
        "default": "Roborock",
        "description": "The platform name shown in the Homebridge log."
      },
      "email": {
        "title": "Email",
        "type": "string",
        "format": "email",
        "description": "Email address for the Roborock account that owns or has access to the vacuum."
      },
      "password": {
        "title": "Password",
        "type": "string",
        "format": "password",
        "placeholder": "Password",
        "description": "Roborock account password. Used for password login or as a fallback when no encrypted token is available."
      },
      "encryptedToken": {
        "title": "Encrypted Token",
        "type": "string",
        "description": "Encrypted Roborock session data. This is created and managed by the plugin UI after a successful login.",
        "readOnly": true
      },
      "skipDevices": {
        "title": "Skip Devices",
        "type": "string",
        "description": "Comma-separated Roborock serial numbers or DUIDs to ignore during discovery."
      },
      "baseURL": {
        "title": "Region",
        "type": "string",
        "default": "https://usiot.roborock.com",
        "enum": [
          "https://usiot.roborock.com",
          "https://euiot.roborock.com",
          "https://cniot.roborock.com",
          "https://api.roborock.com"
        ],
        "enumNames": [
          "US (usiot.roborock.com)",
          "EU (euiot.roborock.com)",
          "CN (cniot.roborock.com)",
          "Asia (api.roborock.com)"
        ],
        "description": "Roborock cloud region endpoint. Choose the region used by your Roborock account."
      },
      "debugMode": {
        "title": "Debug Mode",
        "description": "Write verbose Roborock API, discovery, and transport diagnostics to the Homebridge log.",
        "type": "boolean",
        "default": false
      },
      "transientWarningThrottleHours": {
        "title": "Transient Warning Interval",
        "description": "Hours between repeated transient timeout warnings for each vacuum. Use 0 to hide these recurring warnings unless debug logging is enabled.",
        "type": "number",
        "default": 6,
        "minimum": 0
      },
      "enableMatterServiceArea": {
        "title": "Enable Matter Room/Map Selection",
        "description": "Adds Matter Service Area room and map selection to the Matter vacuum for clients that support it. Disable this if a Matter controller gets stuck showing the vacuum as Updating.",
        "type": "boolean",
        "default": true
      },
      "enableLiveRoomTracking": {
        "title": "Enable Live Room Tracking",
        "description": "While a robot is actively cleaning, periodically fetch the robot's map position (every ~10 seconds) and report the room it is physically inside as the current Matter Service Area, so controllers like Apple Home can show 'cleaning in <room>'. Both generations are covered: B01/Q7 robots via the SCMap position, classic S/Q-series robots via the RRMap segment grid. Requires Matter Room/Map Selection. Disable to avoid the extra map traffic.",
        "type": "boolean",
        "default": true
      },
      "enableMatterPowerSource": {
        "title": "Enable Matter Battery",
        "description": "Adds the Matter battery/power-source cluster to the Matter vacuum. Disable this if a Matter controller gets stuck showing the vacuum as Updating.",
        "type": "boolean",
        "default": true
      },
      "enableMatterCleanMode": {
        "title": "Enable Matter Cleaning Mode Selection",
        "description": "Adds Matter vacuum/mop cleaning mode selection to the Matter vacuum. Disable this if a Matter controller shows the vacuum as No Response after pairing.",
        "type": "boolean",
        "default": true
      },
      "enableFanPowerCleanModes": {
        "title": "Enable Suction-Level Cleaning Modes",
        "description": "Quiet / Balanced / Turbo / Max vacuum modes in the Matter cleaning mode list, so suction can be chosen directly from Apple Home. On by default. Matter fixes the mode list when the robot is paired, so a robot paired before 3.12.0 needs one remove-and-re-pair before the levels appear. BEFORE TURNING THIS OFF, select Vacuum, Mop or Vacuum + Mop in Apple Home: Matter restores the stored cleaning mode on every start, and a stored suction level that is no longer offered stops the robot from registering at all, so it disappears from Apple Home until this is switched back on. Requires Matter Cleaning Mode Selection.",
        "type": "boolean",
        "default": true
      },
      "enableMatterExtendedOperationalStates": {
        "title": "Enable Matter Dock & Returning Status",
        "description": "The extended Matter statuses: Returning to the dock, Emptying the dust bin, Washing the mop, and Updating maps. On by default. Matter fixes an accessory's capabilities at commissioning, so a robot paired before 3.12.0 needs one remove-and-re-pair in Apple Home before these appear. Which of these Apple Home actually renders is Apple's decision. Unless Charging/Docked status is also enabled below, docked and charging still report as Ready. Note: Roborock's mop DRYING has no operational state of its own in the Matter robot vacuum specification, so it is not reported here.",
        "type": "boolean",
        "default": true
      },
      "enableMatterChargingDockedStates": {
        "title": "Enable Matter Charging/Docked Status",
        "description": "Real Charging and Docked states, so the Apple Home tile shows Charging/Docked instead of Ready. On by default; requires a recent iOS/tvOS. if the tile shows odd status text or pairing misbehaves after enabling, turn this off again and restart the Roborock bridge.",
        "type": "boolean",
        "default": true
      },
      "enableMatterFaultReporting": {
        "title": "Report Faults in Apple Home",
        "description": "Show a robot that has genuinely stopped working as Error instead of Ready: stuck, a blocked brush or wheel, a missing dust bin, a flat battery, a dock it cannot reach. On by default. The tradeoff is that a robot reporting Error may be refused a Start command by Apple Home, which is the correct behaviour for a robot that cannot run. Set this to false in config.json if you would rather a stuck robot kept showing Ready. The empty clean-water tank has its own setting below; the other dock conditions (full waste-water tank, missing dust bag) are still not reported.",
        "type": "boolean",
        "default": true
      },
      "enableMatterTankFaultReporting": {
        "title": "Say Why a Robot Stopped, on the Tile",
        "description": "Publishes Matter's OperationalError attribute, which names the fault behind a stopped robot: an empty clean water tank (drawn by Apple Home as a tap icon on the play button with a 'refill the water tank' message), a robot stuck, a blocked brush or wheel, a missing or full dust bin, a dock it cannot reach. Without it Apple Home can show that the robot has stopped but never why. On by default. Turn it off only if a controller misbehaves on the attribute; this plugin withdrew it twice before 3.12.1 found that the tank fields it read had never reached the code at all.",
        "type": "boolean",
        "default": true
      },
      "enableMatterDockPhases": {
        "title": "Say What the Dock Is Doing",
        "type": "boolean",
        "default": true,
        "required": false,
        "description": "Names the dock's own jobs through Matter's PhaseList and CurrentPhase attributes: emptying the dust bin, washing the mop, drying the mop, updating the map. Drying is the reason it exists — it runs for hours after every mop clean and Matter has no operational state for it, so a phase is the only way to express it at all. On by default. Whether your controller draws a phase is unmeasured; turn this off if a tile misbehaves."
      },
      "matterChargedBatteryThreshold": {
        "title": "Charged Battery Threshold (%)",
        "description": "Battery percentage at which a docked robot switches from Charging to Docked on the Apple Home tile. Default 100. Lower it (e.g. 90) if a worn battery makes the robot report fully charged early.",
        "type": "number",
        "minimum": 1,
        "maximum": 100,
        "default": 100
      },
      "enableHomeKitActionSwitches": {
        "title": "Add Home App Switches for Start, Dock, Empty Bin, Pause and Find",
        "description": "Publishes one extra HomeKit switch per robot per action, so Apple Home automations and Shortcuts can send a command that Apple does not offer for a Matter vacuum. Measured in issue #3: Apple Home has no \"send the vacuum to its dock\" automation action for a Matter vacuum, and a plain switch is an automation action everywhere. Each switch is momentary: it turns itself off again about a second after it is pressed. Off by default, because turning it on adds accessories to your Home app. IMPORTANT \u2014 THESE NEED THEIR OWN PAIRING: the robot reaches Apple Home over Matter, but the switches are HomeKit accessories on this plugin's Homebridge child bridge, which is paired separately. Go to Plugins -> homebridge-roborock-matter -> the three-dot menu -> Child Bridge Config, make sure Enable HAP is ON (on a Matter-only setup it is often off, and until it is on no QR code will work), restart, then press Connect to HomeKit on that same screen and scan THAT QR code. It is not the main Homebridge QR code, and not the robot's Matter pairing code.",
        "type": "boolean",
        "default": false
      },
      "enableHomeKitScheduleSwitches": {
        "title": "Add Home app schedule switches",
        "description": "Publishes one grouped \"<robot> Schedules\" accessory per robot, holding one switch for each schedule you created in the Roborock app — both the device-side schedules older robots keep and the timers on the app's Routines, which is where newer robots such as the Saros 10R keep every schedule (issue #22). Turning a switch off disables that schedule on your Roborock account; turning it on enables it again — so an Apple Home automation or Siri can suspend the weekday clean without opening the Roborock app. The switches only enable and disable existing schedules; creating and editing them stays in the Roborock app, because that is where the days, times and rooms live. Requested in issue #3. Off by default, because turning it on adds accessories to your Home app. IMPORTANT — THESE NEED THEIR OWN PAIRING, exactly like the action switches above: the robot reaches Apple Home over Matter, but these are HomeKit accessories on this plugin's Homebridge child bridge, which is paired separately. Go to Plugins -> homebridge-roborock-matter -> the three-dot menu -> Child Bridge Config, make sure Enable HAP is ON, restart, then press Connect to HomeKit on that same screen and scan THAT QR code.",
        "type": "boolean",
        "default": false
      },
      "enableHomeKitRoutineSwitches": {
        "title": "Add Home app Routine switches",
        "description": "Publishes one grouped \"<robot> Routines\" accessory per robot, holding one momentary switch for each Routine you created in the Roborock app. Turning a switch on runs that Routine — the same request the app's play button sends — and the switch turns itself off again after a moment, so Siri can start a Routine by its name and an Apple Home automation can run one the way it runs a scene (issue #22). Creating and editing Routines stays in the Roborock app. Off by default, because turning it on adds accessories to your Home app, and it needs the same child-bridge pairing as the schedule switches above. Requires the Home app switches master setting.",
        "type": "boolean",
        "default": false
      },
      "homeKitActionSwitches": {
        "title": "Which Switches to Add",
        "description": "Which Home app action switches to add. Return to Dock is the one Apple Home cannot automate, and Empty Bin provides the dock action Apple Home does not show while a compatible robot is docked. Start Cleaning starts the same clean as the Home tile's play button, including any rooms selected there; Pause and Find expose their corresponding commands. Schedules are controlled separately by the \"Add Home app schedule switches\" setting above. Only used when the action-switch setting is on.",
        "type": "array",
        "uniqueItems": true,
        "default": ["dock"],
        "items": {
          "type": "string",
          "enum": ["clean", "dock", "empty", "pause", "locate"],
          "oneOf": [
            {
              "title": "Start Cleaning",
              "enum": ["clean"]
            },
            {
              "title": "Return to Dock",
              "enum": ["dock"]
            },
            {
              "title": "Empty Bin (compatible auto-empty docks only)",
              "enum": ["empty"]
            },
            {
              "title": "Pause",
              "enum": ["pause"]
            },
            {
              "title": "Find (robot announces where it is)",
              "enum": ["locate"]
            }
          ]
        }
      },
      "enableHomeKitStateSensors": {
        "title": "Add Home App Sensors so Automations Can Trigger on the Robot",
        "description": "Publishes one extra read-only HomeKit contact sensor per robot per state, so an Apple Home automation can START when the robot does something. The switches above are commands an automation sends; Apple Home will not accept a Matter vacuum as an automation TRIGGER at all, which was measured twice in issue #3, so nothing the robot does can begin an automation. A contact sensor is a trigger source in every Home client. Each sensor reads Closed while the state it is named after is true and Open when it is not — \"Docked\" is Closed in the dock and Open once the robot leaves. Off by default, because turning it on adds accessories to your Home app. IMPORTANT — THESE NEED THE SAME PAIRING AS THE SWITCHES ABOVE: they are HomeKit accessories on this plugin's Homebridge child bridge, which is paired separately from the robot's Matter connection. Go to Plugins -> homebridge-roborock-matter -> the three-dot menu -> Child Bridge Config, make sure Enable HAP is ON, restart, then press Connect to HomeKit on that same screen and scan THAT QR code. It is not the main Homebridge QR code, and not the robot's Matter pairing code.",
        "type": "boolean",
        "default": false
      },
      "homeKitStateSensors": {
        "title": "Which Sensors to Add",
        "description": "Which states get a sensor. Docked is the one to start with: it is the state most automations read, and \"not docked\" is its own answer. Cleaning is the pair for it — not docked AND not cleaning means the robot is probably stuck somewhere, which is the automation this was asked for. Water Tank Empty is the one Apple Home cannot show any other way: Matter's vacuum device type has no water-tank attribute, so a sensor is the only route to a notification. Only used when the setting above is on.",
        "type": "array",
        "uniqueItems": true,
        "default": ["docked"],
        "items": {
          "type": "string",
          "enum": ["docked", "cleaning", "waterTankEmpty"],
          "oneOf": [
            {
              "title": "Docked (Closed while the robot is in its dock)",
              "enum": ["docked"]
            },
            {
              "title": "Cleaning (Closed while the robot is on a cleaning run)",
              "enum": ["cleaning"]
            },
            {
              "title": "Water Tank Empty (Closed while the robot reports no clean water)",
              "enum": ["waterTankEmpty"]
            }
          ]
        }
      },
      "cloudOnlyMode": {
        "title": "Use Roborock Cloud Only",
        "description": "Disables local LAN discovery and local TCP commands for this plugin, routing commands and status polling through Roborock cloud when available. Useful when local LAN connections appear connected but consistently time out. Restart the Roborock child bridge after changing this setting.",
        "type": "boolean",
        "default": false
      },
      "preferCloudForMatterCommands": {
        "title": "Prefer Roborock Cloud for Matter Commands",
        "description": "Sends Matter vacuum commands through the Roborock cloud when cloud transport is connected. This can avoid local LAN command timeouts on some models, such as S8. Status reporting is unaffected.",
        "type": "boolean",
        "default": false
      }
    },
    "required": ["email"]
  }
}
