Blueprint: Mute Spotify free advertisements

Tested on Google Home Mini speakers:

blueprint:
  name: Mute Spotify free advertisements
  description: Mute volume of smart-speaker when an advertisement is detected.
  domain: automation
  source_url: https://github.com/home-assistant/core/blob/9c5f608ffd5dc55a007403025e3a7c5894e7e2ea/homeassistant/components/automation/blueprints/mute_spotify_ads.yaml
  input:
    mediaplayer_entity:
      name: Media Player
      selector:
        entity:
          domain: media_player

trigger:
  platform: state
  entity_id: !input mediaplayer_entity
  attribute: media_title
  to: "Advertisement"

action:
  - service: media_player.volume_mute
    entity_id: !input mediaplayer_entity
    data:
      is_volume_muted: true
  - wait_for_trigger:
      platform: state
      entity_id: !input mediaplayer_entity
      attribute: media_title
      from: "Advertisement"
  - service: media_player.volume_mute
    entity_id: !input mediaplayer_entity
    data:
      is_volume_muted: false

Example:

automation:
- id: '1608643258000'
  alias: Mute Spotify free advertisements on Bedroom speaker
  description: ''
  use_blueprint:
    path: mute_spotify_ads.yaml
    input:
      mediaplayer_entity: media_player.bedroom_mini
8 Likes

good idea, but: No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.

2 Likes

Nice idea. How does it detect ads?

Checking when the attribute

is set to Advertisement

1 Like

2020-12-22 21:41:05 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Failed to load blueprint: Unable to find mute_spotify_ads.yaml (See /config/configuration.yaml, line 55).

This is genius!

Looks like it can’t apply to Youtube Music though, advertisements seem to be tacked on the start of the song that follows so aren’t uniquely flagged.

This is a great one! Works perfectly

Thank you

Very Nice idea !
If the same could exist for television…
Ho, wait, I do not watch television anymore !

1 Like

not work this blueprint

What about it doesn’t work? What errors did you get? What did you try to fix them?

Same here… did you find how to import it?

Look at the media_position.
Does it change when it’s advertisment?
That is how i track advertisments on chromecast

1 Like

@GrumpyMeow is it possible to update the description with a button from this integration ? it’s about something like that Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled. because I don’t know how to implement it

1 Like

this link not work

The original author forgot to change the source URL to their own GitHub repo or gist. The source URL is only used for updating blueprints when the original changes.

Can anyone explain how to implement this blueprint as pasting the link doesn’t work inside HA? Thanks a lot!

slightly sighs Paste in the link of this forum topic.

Sorry, not to be blunt but several users have reported the same issue of getting the following error message:

No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.

I’m just asking if someone more knowledgeable could write down a few steps how to paste this YAML into blueprints. I can find where to switch to YAML editing in Automations, but I’m kinda lost with blueprints unfortunately. Sorry if this is something basic, I am a relatively new HA user.

  1. Go to Configuration in the sidebar.
  2. Click on Blueprints. image
  3. Click the import button. image
  4. Paste in Blueprint: Mute Spotify free advertisements.

Wait. There’s actually an error for me too. @grumpymeow maybe you should remove the second code block? Anyway, you can always copy it, and make a new file in /config/blueprints/automations/mute_spotify_ads.yaml.

Yes, that’s what I was talking about. But judging by the thread activity the OP isn’t really going to fix this anytime soon, hence my request for some help in ‘manual’ installation.

Anyway, you can always copy it, and make a new file in /config/blueprints/automations/mute_spotify_ads.yaml .

And this is exactly what I was looking for :slight_smile: Thank you!