Forked from JackPoint/mute_media_player_on_call.yaml
Last active
December 8, 2022 18:16
-
-
Save IIIEII/f409851600231339768e6d41cc1c3d1a to your computer and use it in GitHub Desktop.
HomeAssistant Blueprint - Pause media player when phone rings or is calling. Only when person is home and the mediaplayer is playing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Pause mediaplayer when calling. | |
description: > | |
Pause a mediaplayer when phone rings or is calling. | |
Only when person is home and the mediaplayer is playing. | |
domain: automation | |
input: | |
phone_state: | |
name: Phone State sensor | |
description: All sensors form the mobile app. Select the phone state sensor here. | |
selector: | |
entity: | |
integration: mobile_app | |
domain: sensor | |
person: | |
name: Person | |
description: Select the person that needs to be at the zone selected. | |
selector: | |
entity: | |
domain: person | |
zone: | |
name: Zone | |
description: Select the Zone the person needs to be in. | |
default: zone.home | |
selector: | |
entity: | |
domain: zone | |
media_player: | |
name: Media Player | |
description: Select the media player that needs to be muted. | |
selector: | |
entity: | |
domain: media_player | |
trigger: | |
- platform: state | |
entity_id: !input phone_state | |
to: "ringing" | |
- platform: state | |
entity_id: !input phone_state | |
to: "offhook" | |
variables: | |
zone: !input zone | |
zone_name: "{{ zone[5:] }}" | |
entity: !input person | |
condition: | |
- "{{is_state(entity, zone_name)}}" | |
- condition: state | |
entity_id: !input media_player | |
state: playing | |
action: | |
- service: media_player.media_pause | |
entity_id: !input media_player |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment