Embedded Device Configurations
Embedded Device Configurations are currently only supported by Edge Drivers.
Embedded Device Configurations allow Device Configurations to be embedded in the Device Profile itself. This allows for UI customizations in the SmartThings clients (such as the mobile app) without the need to explicitly create and reference A Device Presentation in your Device Profile.
When you embed your Device Configuration in your Edge Driver, the SmartThings platform will automatically generate a Device Presentation based on your Embedded Device Configuration when you package your driver, and associate that Presentation vid
with your Edge Driver. To update your Embedded Device Configuration, change your Device Profile as desired, then repackage your Driver - the platform will automatically generate a new Device Presentation based on your changes.
Defining Your Configuration
Elements of an Embedded Device Configuration can be defined in the device profile with the config
property name. These definitions are used to modify the default generated device configuration. The config
property can be attached to individual capability declarations, where it is applied to that capability in every section of the device configuration.
Examples
Below you can find examples of Embedded Device Configurations in use in various device profiles.
Numeric Range Attached to a Capability
The following example shows a device with a custom color temperature range, with the config
property being attached to the capability definition in the device profile (note that some generated configuration values are omitted for brevity).
This example is not intended to be comprehensive. It shows only the range
property; all other device configuration properties, such as enabledValues
and patch
, may also be set in this way.
- Device Profile
- Generated Device Configuration
components:
- id: main
capabilities:
- id: colorTemperature
config:
values:
- key: "colorTemperature.value"
range: [ 2600, 6200 ]
detailView:
- component: main
capability: colorTemperature
version: 1
values:
- key: colorTemperature.value
range:
- 2600
- 6200
automation:
conditions:
- component: main
capability: colorTemperature
version: 1
values:
- key: colorTemperature.value
enabledValues: []
range:
- 2600
- 6200
actions:
- component: main
capability: colorTemperature
version: 1
values:
- key: setColorTemperature
enabledValues: []
range:
- 2600
- 6200
Enumerated Values Omitted From List
The example below demonstrates omitting enumerated values that a particular device may not support.
For example, the thermostatOperatingState
capability has possible values of cooling
, fan only
, heating
, idle
, pending cool
, pending heat
, and vent economizer
. By listing only the values the device supports, we can eliminate any values the device does not support from appearing as options in the SmartThings app. The following example will show only the values cooling
, fan only
, heating
, and idle
:
- Device Profile
- Generated Device Configuration
components:
- id: main
capabilities:
- id: thermostatOperatingState
config:
values:
- key: "thermostatOperatingState.value"
enabledValues:
- cooling
- fan only
- heating
- idle
detailView:
- component: main
capability: thermostatOperatingState
version: 1
values:
- key: thermostatOperatingState.value
enabledValues:
- cooling
- fan only
- heating
- idle
automation:
conditions:
- component: main
capability: colorTemperature
version: 1
values:
- key: thermostatOperatingState.value
enabledValues:
- cooling
- fan only
- heating
- idle
Since the thermostatOperatingState
capability does not define any commands, it does not have an automations/commands section. If it did, that section would also contain only these same four values.
Setter Command and Attribute Values
Capabilities with enumerated attribute values and a setter command to update that attribute can require separate lists for the attribute and command values. For example, your thermostat may have off
, heat
, and eco
modes, but the user is only able to set the mode to off
or heat
- the thermostat itself determines when eco mode is set.
In the example embedded config and resulting device configuration for thermostatMode
below, all three modes will appear as possible automation triggers, but only off
and heat
will be able to be set in the detail view or automation actions. Note that the values
item with the attribute key (setThermostatMode
) is included in the automation actions section.
- Device Profile
- Generated Device Configuration
components:
- label: main
id: main
capabilities:
- id: thermostatMode
config:
values:
- key: thermostatMode.value
enabledValues:
- off
- heat
- eco
- key: setThermostatMode
enabledValues:
- off
- heat
detailView:
- component: main
capability: thermostatMode
version: 1
values:
- key: setThermostatMode
enabledValues:
- off
- heat
automation:
conditions:
- component: main
capability: thermostatMode
version: 1
values:
- key: thermostatMode.value
enabledValues:
- off
- heat
- eco
actions:
- component: main
capability: thermostatMode
version: 1
values:
- key: setThermostatMode
enabledValues:
- off
- heat
Enum Commands and Attributes Values
Some capabilities, such as alarm
, do not have a setter command but do have multiple “enum commands” that change the values of an attribute. The set of possible values for them can be constrained using the {{enumCommands}}
key:
- Device Profile
- Generated Device Configuration
components:
- label: main
id: main
capabilities:
- id: alarm
config:
values:
- key: alarm.value
enabledValues:
- off
- siren
- key: "{{enumCommands}}"
enabledValues:
- off
- siren
detailView:
- component: main
capability: alarm
version: 1
values:
- key: "{{enumCommands}}"
enabledValues:
- off
- siren
automation:
conditions:
- component: main
capability: alarm
version: 1
values:
- key: alarm.value
enabledValues:
- off
- siren
actions:
- component: main
capability: alarm
version: 1
values:
- key: "{{enumCommands}}"
enabledValues:
- off
- siren