# Smart Home InputSelector Trait Schema

`action.devices.traits.InputSelector` - This trait is used for devices which are able to switch inputs.

Media inputs can have dynamic names per device that represent audio or video feeds. These feeds
can be hardwired or networked, but they should be named and reasonably persistent. This trait
does not support arbitrary ephemeral feeds, such as a searchable networked library. Paired, named
Bluetooth sources are supported. Sources can have multiple names, so user-created and discovered
names are supported, as well as default names;for example, 'hdmi_1'might also be 'DVD player,'
or 'usb_1' might also be 'Hard drive'.

Media inputs can be ordered to support 'next' and 'previous' commands.

As with [Toggles](https://developers.home.google.com/cloud-to-cloud/traits/toggles) and [Modes](https://developers.home.google.com/cloud-to-cloud/traits/modes), the names
of inputs should be provided in all available languages; this is especially relevant for default names.

## 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 |
|---|---|---|
| `availableInputs` | *Array* | **Required.** List of objects representing input audio or video feeds. Feeds can be hardwired or networked. Each feed should be named and reasonably persistent. Make sure to define your synonyms carefully to prevent undesired (over-)triggering. |
| `[*item, ...*]` | *Object* | Available input. |
| `key` | *String* | **Required.** Unique key for the input. The key should not be exposed to users in speech or response. |
| `names` | *Array* | **Required.** List of names for the input for all available languages. |
| `[*item, ...*]` | *Object* | Input for a given available language. |
| `lang` | *String* | **Required.** Language code. |
| `name_synonym` | *Array* | **Required.** User-friendly names for the input, in a given language. The first synonym is used in Google Assistant's response to the user. |
| `[*item, ...*]` | *String* | Input name. |
| `commandOnlyInputSelector` | *Boolean* | (Default: `false`) Indicates if the device supports using one-way (true) or two-way (false) communication. Set this attribute to true if the device cannot respond to a QUERY intent or Report State for this trait. |
| `orderedInputs` | *Boolean* | (Default: `false`) True if the list of output is ordered. This also indicates that the 'next' and 'previous' functionality is available. |

#### Examples

*Device with two ordered inputs.*

```
{
  "availableInputs": [
    {
      "key": "hdmi_1",
      "names": [
        {
          "lang": "en",
          "name_synonym": [
            "HDMI 1",
            "1st HDMI",
            "DVD Player"
          ]
        },
        {
          "lang": "de",
          "name_synonym": [
            "HDMI 1",
            "Zuerst HDMI",
            "DVD Spieler"
          ]
        }
      ]
    },
    {
      "key": "usb_1",
      "names": [
        {
          "lang": "en",
          "name_synonym": [
            "USB 1",
            "First USB",
            "Hard Drive"
          ]
        },
        {
          "lang": "de",
          "name_synonym": [
            "USB 1",
            "Zuerst USB",
            "Festplatte"
          ]
        }
      ]
    }
  ],
  "orderedInputs": true
}
```

## 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 |
|---|---|---|
| `currentInput` | *String* | **Required.** Key of the input currently in use. |

#### Examples

*Device with HDMI input currently selected.*

```
{
  "currentInput": "hdmi_1"
}
```

> [!NOTE]
> **Note:** InputSelector does not support query grammar. All state changes must be reported via [Report State](https://developers.home.google.com/cloud-to-cloud/integration/report-state).

## 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.SetInput`

Set the media input.

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `newInput` | *String* | **Required.** Key of the new input. |

#### Examples

*Select USB input*

```
{
  "command": "action.devices.commands.SetInput",
  "params": {
    "newInput": "usb_1"
  }
}
```

### `action.devices.commands.NextInput`

Select the next input. Only applicable when the `orderedInputs` attribute is set to true.
This command requires the following attributes:

```
{
  "orderedInputs": true
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.NextInput",
  "params": {}
}
```

### `action.devices.commands.PreviousInput`

Select the previous input. Only applicable when the `orderedInputs` attribute is set to true.
This command requires the following attributes:

```
{
  "orderedInputs": true
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.PreviousInput",
  "params": {}
}
```

## 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

- Ändere den Eingangskanal auf *AUX* .

### en-US

- change input mode to *HDMI 1*

### es-ES

- cambia a *hdmi 1*

### fr-FR

- Activation du mode *HDMI1* .
- Mets *la télé* sur *HDMI 1* .

### hi-IN

- *टीवी* की इनपुट *HDMI 1* में स्विच करो

### it-IT

- metti ingresso *aux* *sulla tv*

### ja-JP

- *テレビ* *HDMI1* にして

### ko-KR

- *TV* *HDMI 1* 로 바꿔 줘

### nl-NL

- zet *de TV* op *bluetooth*

### pt-BR

- Muda a entrada da *TV* para *HDMI2* .
- mudar a entrada para *AUX*

### sv-SE

- Sätt på *hdmi 1*

## Device ERRORS

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

`unsupportedInput`: The input is not currently supported.