Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save IIIEII/f409851600231339768e6d41cc1c3d1a to your computer and use it in GitHub Desktop.
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.
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