Skip to main content

Home API Reference

Commissioner APIs

Overview

The Commissioner API allows you to control devices and allows these devices to communicate with each other. Device commissioning is the process of joining a device to SmartThings.

To commission a device, you need to use the CommissioningClient API.

API Reference

Device Commissioning

Required packages

import com.samsung.android.matter.home.api.Matter
import com.samsung.android.matter.home.api.CommissioningResult

Create a CommissioningClient instance through the following API. This is the entry point for the Commissioning features.

APIReturnDescription
Matter.getCommissioningClient()CommissioningClientCreates an instance of the Commissioning Client.

Once you have a CommissioningClient instance, you can use the following APIs to commission a device to SmartThings fabric.

This API returns an IntentSender, which launches the onboarding activity in Home Service.

APIReturnDescription
commissionDevice(context: Context)IntentSenderCommission a device into SmartThings fabric.

Device Sharing

Required packages

import com.samsung.android.matter.home.api.Matter
import com.samsung.android.matter.home.api.SharingResult

Create a CommissioningClient instance through the following API. This is the entry point for the Commissioning features.

APIReturnDescription
Matter.getCommissioningClient()CommissioningClientCreates an instance of the Commissioning Client.

Once you have a CommissioningClient instance, you can use the following APIs to share the device to other platforms. This API returns an IntentSender, which launches the device sharing activity in Home Service.

APIReturnDescription
shareDevice(context: Context, shareDeviceRequest: ShareDeviceRequestIntentSenderShare a device to other platforms. shareDeviceRequest : set the device id as ShareDeviceRequest(deviceId)

Controller APIs

Overview

Capabilities are core to the SmartThings architecture. They abstract specific devices into their underlying functions, allowing us to retrieve the state of a Device component or control a function of the Device. And the capabilities of each device are dependent on the manufacturer and the device itself. So the Home API also works based on capabilities.

Supported Device Type and available capability

Device TypeAvailable Capabilities
SwitchSwitch SwitchLevel ColorControl ColorTemperature
Light SwitchSwitchLevel ColorControl ColorTemperature
Door Lock (Smart Lock)Lock LockCodes TamperAlert Battery
Contact SensorContactSensor Battery
Motion SensorMotionSensor Battery
ThermostatTemperatureMeasurement ThermostatMode ThermostatFanMode ThermostatHeatingSetpoint ThermostatCoolingSetpoint ThermostatOperatingState RelativeHumidityMeasurement Battery
Window Covering (Blind)WindowShade WindowShadePreset WindowShadeLevel Battery
Media (Television)MediaPlayback MediaTrackControl KeypadInput Switch

API Reference

Required packages

import com.samsung.android.matter.home.api.Matter
import com.samsung.android.matter.home.api.capability.*

Create a MatterClient instance through the following API. This is the entry point for the Controller features.

APIReturnDescription
Matter.getClient(context: Context)HomeClient Creates an instance of the Matter Client.

Once you have a MatterClient instance, you can get a device by the device id.

APIReturnDescription
getDevice(deviceId: String)Device?Get a device that has capabilities by the device id

Once you have a Device , you can get a Capability per each device type. Then you can control the device and can get the device state.

APIReturnDescription
readCapability(capability: CapabilityFactory T)T?Get a capability that has control command and device attribute

Once you have a Capability , you can use the following control APIs per each device type.

All commands are suspend functions and completed only when a response is received from the API. When command is completed, the API will return either 1) completed, or 2) error.

Battery capability

Attributes

NameTypeDescription
batteryInt [0..100]An indication of the status of the battery

ColorControl capability

Commands

APIReturnDescription
setColor(hue: Double, saturation: Double)DeviceCommandResultSend a command to set the hue and saturation value of the color (hue, saturation - refer to the following APIs)
setHue(hue: Double)DeviceCommandResultSend a command to set the hue value of the color (hue - a number in the range ‘0-100’ representing the hue as a value of percent)
setSaturation(saturation: Double)DeviceCommandResultSend a command to set the saturation value of the color (saturation - a number in the range ‘0-100’ representing the saturation as a value of percent)

Attributes

NameTypeDescription
colorStringNOT SUPPORTED YET
hueDouble [0..100]A number in the range ‘0-100’ representing as a value of percent
saturationDouble [0..100]A number in the range ‘0-100’ representing as a value of percent

ColorTemperature capability

Commands

APIReturnDescription
setColorTemperature(temperature: Int)DeviceCommandResultSend a command to set the color temperature - the value to set the color temperature attribute to, in Kelvin [1 - 30000]

Attributes

NameTypeDescription
colorTemperatureInt [1 - 30000]A number that represents the color temperature, measured in degrees Kelvin

ContactSensor capability

Attributes

NameTypeDescription
contactEnumThe current state of the contact sensor (open, closed)

KeypadInput capability

Commands

APIReturnDescription
sendKey(key: KeyCode)DeviceCommandResultSend keypad input to process a keycode as input to the media device. (key - the key code to process [enum])

Lock capability

Commands

APIReturnDescription
lock()DeviceCommandResultSend a command to lock the lock
unlock()DeviceCommandResultSend a command to unlock the lock

Attributes

NameTypeDescription
lockEnumThe current state of the contact sensor (locked, unlocked)

LockCodes capability

Commands

APIReturnDescription
deleteCode(codeSlot: Int)DeviceCommandResultSend a command to delete the code
lock()DeviceCommandResultSend a command to lock the lock
reloadAllCodes()DeviceCommandResultSend a command to reload all the codes
requestCode(codeSlot: Int)DeviceCommandResultSend a command to request a code
setCode(codeSlot: Int, codePin: String, codeName: String)DeviceCommandResultSend a command to set a code (codeSlot - a number of code slot to delete [0..∞]; codePin - a pin string for the code [string]; codeName - a code name for the code [string]
setCodeLength(length: Int)DeviceCommandResultSend a command to set the code length for the code
unlock()DeviceCommandResultSend a command to unlock the lock
updateCodes(codes: Any)DeviceCommandResultSend a command to update the codes

Attributes

NameTypeDescription
codeChangedStringNOT SUPPORTED YET
codeLengthIntNOT SUPPORTED YET
codeReportIntNOT SUPPORTED YET
lockBooleanNOT SUPPORTED YET
lockCodesStringNOT SUPPORTED YET
maxCodeLengthIntNOT SUPPORTED YET
maxCodesIntNOT SUPPORTED YET
minCodeLengthIntNOT SUPPORTED YET
scanCodesStringNOT SUPPORTED YET

MediaPlayback capability

Commands

APIReturnDescription
fastForward()DeviceCommandResultSend a command to fast forward the media playback
pause()DeviceCommandResultSend a command to pause the media playback
stop()DeviceCommandResultSend a command to stop the media playback

Attributes

NameTypeDescription
playbackStatusEnumStatus of the media playback (paused - Media playback is in a "paused" state, playing - Media playback is in a "playing" state, stopped - Media playback is in a "stopped" state, fast forwarding - Media playback is in a "fast forwarding" state, rewinding - Media playback is in a "rewinding" state, buffering - Media playback is in a "buffering" state
supportedPlaybackCommandsArray of EnumNOT SUPPORTED YET

MediaTrackControl capability

Commands

APIReturnDescription
nextTrack()DeviceCommandResultSend a command to go to the next track
previousTrack()DeviceCommandResultSend a command to go to the previous track

MotionSensor capability

Attributes

NameTypeDescription
motionEnumThe current state of the motion sensor (active - The value when motion is detected, inactive - The value when no motion is detected)

Switch capability

Commands

APIReturnDescription
on()DeviceCommandResultSend an on command to the device
off()DeviceCommandResultSend an off command to the device

Attributes

NameTypeDescription
switchEnumThe state of whether the the switch (on, off)

SwitchLevel capability

Commands

APIReturnDescription
setLevel(level: Int)DeviceCommandResultSend a command to set the level of a device like a light or a dimmer switch. level - a number that represents the current level, usually ‘0-100’ in percent

Attributes

NameTypeDescription
levelInt [0..100]A number in the range ‘0-100’ representing as a value of percent

TamperAlert capability

Attributes

NameTypeDescription
tamperEnumA number that represents the current level (clear - not tampered detected - tampered)

TemperatureMeasurement capability

Attributes

NameTypeDescription
temperatureDouble [-460..10000]A number that usually represents the current temperature in Fahrenheit

ThermostatCoolingSetpoint capability

Commands

APIReturnDescription
setCoolingSetpoint(setpoint: Double)DeviceCommandResultSend a command to set the cooling setpoint (a value that the cooling setpoint should be set to number [-460..10000])

Attributes

NameTypeDescription
coolingSetpointDouble [-460..10000]The current cooling setpoint

ThermostatFanMode capability

Commands

APIReturnDescription
fanAuto()DeviceCommandResultSend a command to set the fan mode to auto
fanCirculate()DeviceCommandResultSend a command to set the fan mode to circulate
fanOn()DeviceCommandResultSend a command to set the fan mode to on
setThermostatFanMode(mode: String)DeviceCommandResultSend a command to set the thermostat fan mode (auto , circulate , followschedule , on)

Attributes

NameTypeDescription
thermostatFanModeEnumThe current mode of the fan on a thermostat (auto - The fan is on auto; circulate - The fan is circulating; followschedule - The fan is set to follow predefined schedule; on - The fan is on)

ThermostatHeatingSetpoint capability

Commands

APIReturnDescription
setHeatingSetpoint(setpoint: Double)DeviceCommandResultSend a command to set the heating setpoint (setpoint: a value that the heating setpoint should be set to number [-460..10000])

Attributes

NameTypeDescription
heatingSetpointDouble [-460..10000]The current heating setpoint

ThermostatMode capability

Commands

APIReturnDescription
auto()DeviceCommandResultSend a command to set the mode to 'auto'
cool()DeviceCommandResultSend a command to set the mode to 'cool'
emergencyHeat()DeviceCommandResultSend a command to set the mode to 'emergency heat'
heat()DeviceCommandResultSend a command to set the mode to 'heat'
off()DeviceCommandResultSend a command to set the mode to 'off'

Attributes

NameTypeDescription
thermostatModeEnumThe current mode of a thermostat (auto, cool, heat, off)

ThermostatOperatingState capability

Attributes

NameTypeDescription
thermostatOperatingStateEnumThe current state that the thermostat is operating in (cooling, fan only, heating, idle, pending cool, pending heat, vent economizer)

WindowShade capability

Commands

APIReturnDescription
close()DeviceCommandResultSend a command to close the window shade
open()DeviceCommandResultSend a command to open the window shade
pause()DeviceCommandResultSend a command to pause opening or closing the window shade

Attributes

NameTypeDescription
windowShadeEnumAn indication of the status of the window shade (closed, closing, open, opening, partially open, unknown)

WindowShadeLevel capability

Commands

APIReturnDescription
setShadeLevel(shadeLevel: Int)DeviceCommandResultSend a command to set the shade level to the given value (integer [0..100])

Attributes

NameTypeDescription
shadeLevelInt [0..100]A number that represents the current level as a function of being open, ‘0-100’ in percent (0: closed; 100: open).

WindowShadePreset capability

Commands

APIReturnDescription
presetPosition()DeviceCommandResultSend a command to open window shade to a preset position

Location APIs

Overview

Location in SmartThings is the main entity for your connected Devices.

Room is the best way to group devices in SmartThings. You can use Rooms to separate your devices into distinct areas and more easily organize large lists of connected devices.

So you need to get the Locations and Rooms then you can get the Devices.

API Reference

Required packages

import com.samsung.android.matter.home.api.Matter

Create a MatterClient instance through the following API. This is the entry point for the location features.

APIReturnDescription
Matter.getClient(context: Context)HomeClientCreates an instance of the Matter Client.

Once you have a MatterClient instance, you can get location information.

All commands are suspend functions and complete only when received a response from the API. It means the state of device has changed if there is no error.

APIReturnDescription
getLocations()Flow: List > LocationGet a list of locations that belong to your account.
getRooms()Flow: List > RoomGet a list of rooms in location that belong to your account.
getDevices()Flow: List > DeviceGet a list of devices in room that belong to your account.