In your particular case:
Dreame has integrated Matter support into its 2025/2026 flagship robot vacuums (such as the X50 Ultra, X40 Ultra, and L40s series), enabling local, secure, and fast smart home connectivity
Gemini says the driver for it should look like:
/**
* Hubitat Matter Driver for Dreame X50 Ultra Vacuum
* Protocol: Matter over Wi-Fi (Standard RVC Clusters)
*/
metadata {
definition(name: "Dreame X50 Ultra Matter Vacuum", namespace: "custom", author: "Gemini") {
capability "Switch" // On = Start Vacuuming, Off = Return to Dock
capability "Refresh"
capability "Configuration"
attribute "operationalState", "string"
attribute "batteryLevel", "number"
// Matter Endpoint & Cluster Definitions (Standard Matter 1.2 RVC Spec)
// Endpoint: 0x01, Operational State Cluster: 0x0060, Run Mode Cluster: 0x006D
}
preferences {
input name: "logEnable", type: "bool", title: "Enable debug logging", defaultValue: true
}
}
// Handle data coming from the Hubitat Matter layer
def parse(String description) {
if (logEnable) log.debug "parse description: ${description}"
def descMap = matter.parseDescriptionAsMap(description)
if (!descMap) return
// Parse Operational State Cluster (0x0060) Attribute Changes
if (descMap.clusterInt == 0x0060 && descMap.command == "0a") {
def attrId = descMap.attrInt
// Attribute 0x0004: OperationalState
if (attrId == 0x0004) {
int stateValue = Integer.parseInt(descMap.value, 16)
String stateStr = decodeOperationalState(stateValue)
sendEvent(name: "operationalState", value: stateStr)
// Map to standard Switch Capability
if (stateValue == 1) { // Running/Cleaning
sendEvent(name: "switch", value: "on")
} else if (stateValue == 0) { // Stopped/Docked
sendEvent(name: "switch", value: "off")
}
}
}
// Parse Power Source Cluster (0x002F) for Battery status
if (descMap.clusterInt == 0x002F && descMap.attrInt == 0x000B) {
int battPct = Integer.parseInt(descMap.value, 16)
sendEvent(name: "batteryLevel", value: battPct)
}
}
// Send command to begin cleaning sequence
def on() {
if (logEnable) log.debug "Sending Start/Resume Clean command"
// Run Mode Cluster (0x006D), ChangeToMode Command (0x01), Mode value 1 (Cleaning)
List<String> cmds = matter.command(0x01, 0x006D, 0x01, "01")
return cmds
}
// Send command to halt cleaning and return to charging station
def off() {
if (logEnable) log.debug "Sending Stop/Return to Dock command"
// Run Mode Cluster (0x006D), ChangeToMode Command (0x01), Mode value 0 (Idle/Docked)
List<String> cmds = matter.command(0x01, 0x006D, 0x01, "00")
return cmds
}
def refresh() {
if (logEnable) log.debug "Refreshing device state"
List<String> cmds = []
cmds.add(matter.readAttribute(0x01, 0x0060, 0x0004)) // Read OperationalState
cmds.add(matter.readAttribute(0x01, 0x002F, 0x000B)) // Read Battery Percent
return cmds
}
def configure() {
if (logEnable) log.debug "Configuring Matter subscriptions"
List<Map<String, String>> attributePaths = []
attributePaths.add(matter.attributePath(0x01, 0x0060, 0x0004)) // Subscribe to State
attributePaths.add(matter.attributePath(0x01, 0x002F, 0x000B)) // Subscribe to Battery
// Subscribe with a 5-second min and 3600-second max reporting window
String subscribeCmd = matter.subscribe(5, 3600, attributePaths)
return [subscribeCmd]
}
private String decodeOperationalState(int value) {
switch(value) {
case 0: return "Stopped"
case 1: return "Running"
case 2: return "Paused"
case 3: return "Error"
default: return "Unknown"
}
}