- configBooleanValue
- configDateValue
- configDevices
- configDevicesWithState
- configModeIds
- configNumberValue
- configStringValue
- configTimeString
- isAuthenticated
- retrieveTokens
- setLocationId
• api: SmartThingsClient
An instance of the SmartThings core API instantiated with the access token for the installed app instance.
• config: ConfigMap
The SmartApp configuration object containing the values of all user selections made during app installation.
▸ configBooleanValue(id
: string): boolean
Returns the specified configuration setting typed as a boolean
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: boolean
▸ configDateValue(id
: string): Date
Returns the specified configuration setting typed as a Date object
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: Date
▸ configDevices(id
: string): Promise‹DeviceContext[]›
Retrieves the devices specified in the configuration along with their names and labels (which are not stored in the configuration map and so require API calls)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: Promise‹DeviceContext[]›
▸ configDevicesWithState(id
: string): Promise‹DeviceStateContext[]›
Retrieves the devices specified in the configuration along with their names, labels, and the current values of all of their capabilities.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: Promise‹DeviceStateContext[]›
▸ configModeIds(id
: string): string[]
Returns a list of mode ids from the specified mode configuration setting
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: string[]
▸ configNumberValue(id
: string): number
Returns the specified configuration setting typed as a number
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: number
▸ configStringValue(id
: string): string
Returns the specified configuration setting typed as a string
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: string
▸ configTimeString(id
: string): string
Returns the specified configuration setting typed as a time string
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the id specified when the setting was created |
Returns: string
▸ isAuthenticated(): boolean
Tests whether the context is authenticated to make API calls, i.e. has an accessToken. Note that this method does not actually test the validity of the token, but rather whether it is present or not. Contexts of CONFIGURATION lifecycle events are not authenticated. Therefore if an app needs to make API calls during the configuration lifecycle it must use a token store to authenicate itself.
Returns: boolean
▸ retrieveTokens(): Promise‹SmartAppContext›
Retrieve the tokens of the installed instance from the token store and return a new, authenticated SmartAppContext. This method is typically used to allow API calls to be made from the handlers of CONFIGURATION/PAGE lifecycle events.
Returns: Promise‹SmartAppContext›
▸ setLocationId(id
: string): void
Sets the location of the app context. Explicitly setting the location is typically necessary when an API Access app is first authorized. It is not needed when handling lifecycle events.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | the location UUID |
Returns: void