Ad Mute

A Home Assistant automation that mutes my TV when a Disney+ ad starts and unmutes it when the show comes back. Nothing tells Home Assistant that an ad is playing, so it works that out from how the playback position behaves.

August 2026

A diagram of playback position over time: it climbs during the show, stays flat through the ad break, and climbs again afterwards
An illustration of the signal, not recorded data: the position climbs during the show and stops during an ad.

Why I Built This

I wanted the TV to mute itself when ads come on. The trouble was that I couldn't find anything in Home Assistant that says an ad is playing. The media player reports the app, the title, and whether it's playing or paused, and none of that changes during an ad break.

The Signal

What I did notice is that the media_position attribute behaves differently during a show than during an ad.

  • During a show, the Cast integration reports a new position about twice a second, each one half a second further along.
  • During an ad, it sits at nearly the same number for the whole break, only changing by a few thousandths of a second.
  • When the show comes back, it starts counting again.

How It Works

The automation fires on every position report and compares it to the last one. If the two are within 0.25 seconds of each other, it mutes. Otherwise it unmutes. It only sends the command when the mute state would change, so that's one mute at the start of the break and one unmute at the end. It's been working really well so far.

This is on a TCL Google TV through the Cast integration. The signal comes from the app, not the TV, so any Cast device running Disney+ should behave the same. I haven't tested other streaming services yet.

The Automation

To use it, swap media_player.smart_tv for your own entity ID.

alias: Disney+ ad mute
mode: single
max_exceeded: silent
triggers:
  - trigger: state
    entity_id: media_player.smart_tv
    attribute: media_position_updated_at
conditions:
  - condition: state
    entity_id: media_player.smart_tv
    state: playing
  - condition: state
    entity_id: media_player.smart_tv
    attribute: app_name
    state: Disney+
actions:
  - if:
      - condition: template
        value_template: >-
          {% set delta = (trigger.to_state.attributes.media_position | float(0))
                       - (trigger.from_state.attributes.media_position | float(0)) %}
          {{ (delta | abs) < 0.25 }}
    then:
      - if:
          - condition: state
            entity_id: media_player.smart_tv
            attribute: is_volume_muted
            state: false
        then:
          - action: media_player.volume_mute
            target:
              entity_id: media_player.smart_tv
            data:
              is_volume_muted: true
    else:
      - if:
          - condition: state
            entity_id: media_player.smart_tv
            attribute: is_volume_muted
            state: true
        then:
          - action: media_player.volume_mute
            target:
              entity_id: media_player.smart_tv
            data:
              is_volume_muted: false

I shared this on r/homeassistant. If you try it with another service, I'd like to hear how it goes.

Tech Stack

Home AssistantCast integrationYAMLJinja templatesGoogle TV