Skip to content

Instantly share code, notes, and snippets.

@ndom91
Last active April 20, 2025 11:01
Show Gist options
  • Save ndom91/b66d508960dd8587da52aad26c85b15e to your computer and use it in GitHub Desktop.
Save ndom91/b66d508960dd8587da52aad26c85b15e to your computer and use it in GitHub Desktop.
Voice PE - Pause Media while Listening
alias: Voice PE - Pause TV when Voice PE Listening
description: "In order to improve voice command recognition, pause any media players playing in the background while listening for a command."
triggers:
- trigger: state
entity_id:
- assist_satellite.home_assistant_voice_090de2_assist_satellite # Voice PE Satellite entity
to: listening
conditions:
- condition: not
conditions:
- condition: state
entity_id: assist_satellite.home_assistant_voice_090de2_assist_satellite # Voice PE Satellite entity
state: idle
- condition: state
entity_id: assist_satellite.home_assistant_voice_090de2_assist_satellite # Voice PE Satellite entity
state: unavailable
- condition: state
entity_id: assist_satellite.home_assistant_voice_090de2_assist_satellite # Voice PE Satellite entity
state: unknown
actions:
- alias: If TV is playing; Pause until Voice Action complete
if:
- condition: state
entity_id: media_player.livingroom_tv_001 # Media Player entity_id
state: playing
then:
- action: media_player.media_pause
target:
entity_id: media_player.livingroom_tv_001 # Media Player entity_id
- wait_for_trigger:
- trigger: state
entity_id: assist_satellite.home_assistant_voice_090de2_assist_satellite # Voice PE Satellite entity
to: idle
timeout:
hours: 0
minutes: 0
seconds: 20
milliseconds: 0
enabled: true
- action: media_player.media_play
target:
entity_id: media_player.livingroom_tv_001 # Media Player entity_id
@ndom91
Copy link
Author

ndom91 commented Apr 20, 2025

To use, create a new automation in the UI. Click the three-dot overflow menu and select "Edit in YAML" and replace all of the existing content with the script above.

Don't forget to replace the entities with yours. I've highlighted those that need to be replaced with a comment describing what you'll need afterwards.

Feel free to share any cool modifications you come up with 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment