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 and 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 operation. To learn more about handling SYNC intents, see Intent fulfillment.

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

Devices with this trait may report the following states as part of the QUERY operation. To learn more about handling QUERY intents, see Intent fulfillment.

States Type Description
currentInput String

Required.

Key of the input currently in use.

Examples

Device with HDMI input currently selected.

{
  "currentInput": "hdmi_1"
}

Device COMMANDS

Devices with this trait may respond to the following commands as part of the EXECUTE operation. To learn more about handling EXECUTE intents, see Intent fulfillment.

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": {}
}

Device ERRORS

See the full list of errors and exceptions.

unsupportedInput: The input is not currently supported.