Add info for new commands/attributes (#1525)

Added description of the commands/attributes added by #4086.
This commit is contained in:
Dan 2016-12-04 14:02:55 -05:00 committed by Fredrik Lindqvist
parent 9ed887e9b1
commit 6c3c531919

View File

@ -51,8 +51,8 @@ Configuration variables:
- **name** (*Required*): The name to assign the player
- **children** (*Required*): Ordered list of child media players this entity will control
- **commands** (*Optional*): Commands to be overwritten. Possible entries are *turn_on*, *turn_off*, *volume_up*, *volume_down*, and *volume_mute*.
- **attributes** (*Optional*): Attributes that can be overwritten. Possible entries are *is_volume_muted* and *state*. The values should be an entity id and state attribute separated by a bar (\|). If the entity id's state should be used, then only the entity id should be provided.
- **commands** (*Optional*): Commands to be overwritten. Possible entries are *turn_on*, *turn_off*, *select_source*, *volume_set*, *volume_up*, *volume_down*, and *volume_mute*.
- **attributes** (*Optional*): Attributes that can be overwritten. Possible entries are *is_volume_muted*, *state*, *source*, *source_list, and *volume_level*. The values should be an entity id and state attribute separated by a bar (\|). If the entity id's state should be used, then only the entity id should be provided.
The universal media player will primarily imitate one of its *children*. The first child in the list that is active (not idle/off) will be controlled the universal media player. The universal media player will also inherit its state from the first active child. Entities in the *children* list must be media players.
@ -60,6 +60,8 @@ It is recommended that the command *turn_on*, the command *turn_off*, and the at
It is also recommended that the command *volume_up*, the command *volume_down*, the command *volume_mute*, and the attribute *is_volume_muted* all be provided together. The attribute *is_volume_muted* should return either True or the on state when the volume is muted. The *volume_mute* service should toggle the mute setting.
When providing *select_source* as a command, it is recomended to also provide the attributes *source*, and *source_list*. The *source* attribute is the currently select source, while the *source_list* attribute is a list of all available sources.
Below is an example configuration.
```yaml
@ -90,11 +92,26 @@ media_player:
service: switch.turn_on
data:
entity_id: switch.living_room_mute
select_source:
service: media_player.select_source
data_template:
entity_id: media_player.receiver
source: '{{ source }}'
volume_set:
service: media_player.volume_set
data_template:
entity_id: media_player.receiver
volume_level: '{{ volume_level }}'
attributes:
state: switch.living_room_tv
is_volume_muted: switch.living_room_mute
volume_level: media_player.receiver|volume_level
source: media_player.receiver|source
source_list: media_player.receiver|source_list
```
In this example, a switch is available to control the power of the television. Switches are also available to turn the volume up, turn the volume down, and mute the audio. These could be command line switches or any other entity in Home Assistant. The *turn_on* and *turn_off* commands will be redirected to the television and the volume commands will be redirected to an audio receiver.
In this example, a switch is available to control the power of the television. Switches are also available to turn the volume up, turn the volume down, and mute the audio. These could be command line switches or any other entity in Home Assistant. The *turn_on* and *turn_off* commands will be redirected to the television and the volume commands will be redirected to an audio receiver. The *select_source* command will be passed directly to an A/V receiver.
The children are a Chromecast and a Kodi player. If the Chromecast is playing, the Universal Media Player will reflect its status. If the Chromecast is idle and Kodi is playing, the Universal Media player will change to reflect its status.