MatterDevice class

Represents a commissioned Matter device and provides typed, capability-aware accessors for interacting with it, instead of the original single-device, name-sniffing-based API.

After commissioning, call discoverEndpoints once to populate endpoints/capabilities from the device's actual advertised clusters (per the Matter spec), then use the capability methods (e.g. getOnOff, setLevel, lockDoor) that make sense for what it reports supporting.

Constructors

MatterDevice(int deviceId, String deviceName, int deviceType, int vendorId, int describeContents)
MatterDevice.fromJson(Map json)

Properties

capabilities → Set<MatterCapability>
The union of MatterCapabilitys across every discovered endpoint. Empty until discoverEndpoints has been called.
no setter
describeContents ↔ int
getter/setter pair
deviceId ↔ int
getter/setter pair
deviceName ↔ String
getter/setter pair
deviceType ↔ int
getter/setter pair
endpoints ↔ List<MatterEndpoint>
Endpoints discovered via discoverEndpoints. Empty until that's been called at least once.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vendorId ↔ int
getter/setter pair

Methods

closeWindowCovering() → Future<void>
discoverEndpoints() → Future<List<MatterEndpoint>>
Queries the device for its endpoints/device types/clusters and caches the result in endpoints. Call this once after commissioning (or whenever you want to re-check what the device currently advertises).
getContactState() → Future<bool?>
Generic boolean sensor state (e.g. contact sensors, water leak detectors).
getFlowMeasurement() → Future<int?>
Tenths of m/h.
getIlluminanceMeasurement() → Future<int?>
Encoded per spec: 10000*log10(lux)+1.
getLastStatus() → Future<bool?>
Gets the last status of this device using the original name-based heuristic (occupancy/PIR -> bitmap cluster, door/contact -> boolean cluster, else -> on/off cluster).
getLevel() → Future<int?>
Current brightness level, 0-254.
getLockState() → Future<int?>
The DoorLock cluster's LockState attribute (1 = Locked, 2 = Unlocked, 3 = NotFullyLocked).
getOccupancy() → Future<int?>
Occupancy bitmap (bit 0: occupied).
getOnOff() → Future<bool?>
getPressureMeasurement() → Future<int?>
kPa.
getRelativeHumidityMeasurement() → Future<int?>
Hundredths of a percent, 0-10000.
getTemperatureMeasurement() → Future<int?>
Hundredths of a degree Celsius.
getThermostatLocalTemperature() → Future<int?>
Local temperature in hundredths of a degree Celsius, e.g. 2100 = 21.00C.
hasCapability(MatterCapability capability) → bool
listenToEvents() → Stream<bool?>
Listens to the the data for this Matter device using the original name-based heuristic.
lockDoor() → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openWindowCovering() → Future<void>
setColorTemperature(int colorTemperatureMireds) → Future<void>
colorTemperatureMireds is the mired color temperature (roughly 1,000,000 / kelvin).
setHueAndSaturation(int hue, int saturation) → Future<void>
setLevel(int level) → Future<void>
Sets brightness level, 0-254.
setThermostatCoolingSetpoint(int coolingSetpointCelsiusX100) → Future<void>
coolingSetpointCelsiusX100 is in hundredths of a degree Celsius, e.g. 2400 = 24.00C.
setThermostatHeatingSetpoint(int heatingSetpointCelsiusX100) → Future<void>
heatingSetpointCelsiusX100 is in hundredths of a degree Celsius, e.g. 2100 = 21.00C.
setWindowCoveringLiftPosition(int liftPercent100ths) → Future<void>
liftPercent100ths is 0-10000 (0 = fully open, 10000 = fully closed).
toggleOnOff() → Future<void>
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited
unlockDoor() → Future<void>

Operators

operator ==(Object other) → bool
The equality operator.
inherited