home-assistant-configuration/config/packages/audio.yaml

51 lines
1.6 KiB
YAML
Executable File

###############################################################################
# @author : Jeffrey Stone
# @date : 04/11/2020
# @package : Audio
# @description : Audio related configuration.
#
# In order to use this package you will need a couple of things.
#
# Add to your configuration.yaml:
# media_extractor:
#
# If you are running Hassio or Home Assistant as it is called now you will need a server that hosts local audio files if you want to leverage those
###############################################################################
# automation:
# # Turn off Input Booleans when audio stops - Based on ha_speaker state.
# - id: reset_ib_when_stopped
# alias: Reset Input Booleans When Stopped
# initial_state: true
# trigger:
# - platform: state
# entity_id: media_player.ha_speaker
# to: "off"
# action:
# - service: homeassistant.turn_off
# entity_id: group.disney_audio
script:
youtube_audio:
sequence:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
- condition: state
entity_id: sensor.family_status
state: Home
- service: media_player.turn_on
entity_id: media_player.ha_speaker
- service: media_player.volume_set
data_template:
entity_id: media_player.ha_speaker
volume_level: >
{{ volume }}
- service: media_extractor.play_media
entity_id: media_player.ha_speaker
data_template:
media_content_type: video/youtube
media_content_id: >
{{ media }}