# Smart Home AppSelector Trait Schema

`action.devices.traits.AppSelector` - This trait is used for devices which are able to switch between applications.

> [!NOTE]
> **Note:** This trait currently supports only user queries and commands in the `en-US` language.

## Device ATTRIBUTES

Devices with this trait may report the following
attributes as part of the [`SYNC`](https://developers.home.google.com/cloud-to-cloud/intents/sync) operation. To learn
more about handling `SYNC` intents, see
[Intent fulfillment](https://developers.home.google.com/cloud-to-cloud/integration/sync).

| Attributes | Type | Description |
|---|---|---|
| `availableApplications` | *Array* | **Required.** A list of applications. Each application has one or more synonyms in each supported language. The first synonym is used in the response. |
| `[*item, ...*]` | *Object* | Application that users of this device can interact with. |
| `key` | *String* | **Required.** Unique key for the application which is not exposed to users in speech or response. |
| `names` | *Array* | **Required.** Name of each application and its language-specific synonyms. |
| `[*item, ...*]` | *Object* | Application synonyms. |
| `name_synonym` | *Array* | **Required.** User-friendly synonyms for the application name for a given language. The first synonym is used in the response. |
| `[*item, ...*]` | *String* | Application name. |
| `lang` | *String* | **Required.** Language code. |

#### Examples

*Device with YouTube app*

```
{
  "availableApplications": [
    {
      "key": "youtube",
      "names": [
        {
          "name_synonym": [
            "YouTube",
            "YouTube US"
          ],
          "lang": "en"
        },
        {
          "name_synonym": [
            "YouTube",
            "YouTube DE"
          ],
          "lang": "de"
        }
      ]
    }
  ]
}
```

## Device STATES

Entities with this trait may report the following
states as part of the [`QUERY`](https://developers.home.google.com/cloud-to-cloud/intents/query) operation. To learn
more about handling `QUERY` intents, see
[Intent fulfillment](https://developers.home.google.com/cloud-to-cloud/integration/query-execute).

| States | Type | Description |
|---|---|---|
| `currentApplication` | *String* | **Required.** Key value of the current application that is active in the foreground. |

#### Examples

*Device with YouTube app currently active on foreground.*

```
{
  "currentApplication": "YouTube"
}
```

> [!NOTE]
> **Note:** The `currentApplication` state can be reported and will be stored in HomeGraph. However, voice querying the state is not supported.

## Device COMMANDS

Devices with this trait may respond to the following
commands as part of the [`EXECUTE`](https://developers.home.google.com/cloud-to-cloud/intents/execute) operation. To learn
more about handling `EXECUTE` intents, see
[Intent fulfillment](https://developers.home.google.com/cloud-to-cloud/integration/query-execute#handle_execute_intents).

### `action.devices.commands.appInstall`

Install the given application.

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `newApplication` | *String* | Key of the application to install. |
| `newApplicationName` | *String* | Name of the application to install. |

#### Examples

*Install YouTube app by key*

```
{
  "command": "action.devices.commands.appInstall",
  "params": {
    "newApplication": "YouTube"
  }
}
```

*Install YouTube app by name*

```
{
  "command": "action.devices.commands.appInstall",
  "params": {
    "newApplicationName": "YouTube US"
  }
}
```

### `action.devices.commands.appSearch`

Search for the given application.

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `newApplication` | *String* | Key of the application to search for. |
| `newApplicationName` | *String* | Name of the application to search for. |

#### Examples

*Search for YouTube app by key*

```
{
  "command": "action.devices.commands.appSearch",
  "params": {
    "newApplication": "YouTube"
  }
}
```

*Search for YouTube app by name*

```
{
  "command": "action.devices.commands.appSearch",
  "params": {
    "newApplicationName": "YouTube US"
  }
}
```

### `action.devices.commands.appSelect`

Select the given application.

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `newApplication` | *String* | Key of the application to select. |
| `newApplicationName` | *String* | Name of the application to select. |

#### Examples

*Select YouTube app by key*

```
{
  "command": "action.devices.commands.appSelect",
  "params": {
    "newApplication": "YouTube"
  }
}
```

*Select YouTube app by name*

```
{
  "command": "action.devices.commands.appSelect",
  "params": {
    "newApplicationName": "YouTube US"
  }
}
```

## Sample utterances

> [!NOTE]
> This is a sample of the utterances supported by this device trait, make sure to also review other [supported languages](https://developers.home.google.com/cloud-to-cloud/traits#supported-languages).

### de-DE

- Öffne *Netflix* *auf dem Fernseher* .

### en-US

- begin using *YouTube* app on *the smart TV*

### es-ES

- pon *netflix* en *la tele del salón*

### fr-FR

- Mets *Netflix* sur *la télé* .

### hi-IN

- *टीवी* पर *नेटफ्लिक्स* ऍप लॉन्च करो

### it-IT

- Apri *Netflix* *sulla televisione della mia camera* .

### ja-JP

- *YouTube* のアプリを *テレビ* でスタート

### ko-KR

- *TV* 에서 *유튜브* 앱 열어 줘

### nl-NL

- Start *Netflix* op *mijn TV* .

### pt-BR

- Abra o *Netflix* na *TV* para mim.
- Abre o *Youtube* na *televisão* .

### sv-SE

- Öppna *Youtube* på *TV:n*

## Device ERRORS

See the full list of [errors and exceptions](https://developers.home.google.com/cloud-to-cloud/intents/errors-exceptions).

- `noAvailableApp`: The application doesn't exist or is not available.
- `appLaunchFailed`: The application failed to launch.
- `alreadyInstalledApp`: The application was already installed.