Add volume actions for media player (#2124)

This commit is contained in:
Jesse Hills 2022-06-13 13:29:35 +12:00
parent b0e3916a45
commit 04e247ec9a
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
2 changed files with 54 additions and 4 deletions

View File

@ -38,10 +38,21 @@ Configuration variables:
See https://developers.home-assistant.io/docs/core/entity/#generic-properties
for a list of available options. Set to ``""`` to remove the default entity category.
Media Player Actions
--------------------
All ``media_player`` actions can be used without specifying an ``id`` if you have only one ``media_player`` in
your configuration YAML.
Configuration variables:
**id** (*Optional*, :ref:`config-id`): The media player to control. Defaults to the only one in YAML.
.. _media_player-play:
``media_player.play`` Action
----------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action will resume playing the media player.
A future change will allow specifying the ``media_url`` for starting
@ -50,24 +61,62 @@ a new stream.
.. _media_player-pause:
``media_player.pause`` Action
-----------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action pauses the current playback.
.. _media_player-stop:
``media_player.stop`` Action
----------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action stops the current playback.
.. _media_player-toggle:
``media_player.toggle`` Action
------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action will pause or resume the current playback.
.. _media_player-volume_up:
``media_player.volume_up`` Action
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action will increase the volume of the media player.
.. _media_player-volume_down:
``media_player.volume_down`` Action
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action will decrease the volume of the media player.
.. _media_player-volume_set:
``media_player.volume_set`` Action
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This action will set the volume of the media player.
.. code-block::
on_...:
# Simple
- media_player.volume_set: 50%
# Full
- media_player.volume_set:
id: media_player_id
volume: 50%
# Simple with lambda
- media_player.volume_set: !lambda "return 0.5;"
Configuration variables:
**volume** (**Required**, percentage): The volume to set the media player to.
See Also
--------

View File

@ -393,6 +393,7 @@ All Actions
- :ref:`number.set <number-set_action>` / :ref:`number.to_min <number-to-min_action>` / :ref:`number.to_max <number-to-max_action>` / :ref:`number.decrement <number-decrement_action>` / :ref:`number.increment <number-increment_action>` / :ref:`number.operation <number-operation_action>`
- :ref:`select.set <select-set_action>` / :ref:`select.set_index <select-set_index_action>` / :ref:`select.first <select-first_action>` / :ref:`select.last <select-last_action>` / :ref:`select.previous <select-previous_action>` / :ref:`select.next <select-next_action>` / :ref:`select.operation <select-operation_action>`
- :ref:`media_player.play <media_player-play>` / :ref:`media_player.pause <media_player-pause>` / :ref:`media_player.stop <media_player-stop>` / :ref:`media_player.toggle <media_player-toggle>`
/ :ref:`media_player.volume_up <media_player-volume_up>` / :ref:`media_player.volume_down <media_player-volume_down>` / :ref:`media_player.volume_set <media_player-volume_set>`
.. _config-condition: