Mute mediaplayer when Teams calling or in meeting

This is a rewrite of Jackpoint blueprint

This blueprint assumes you have this integration:

GitHub - EBOOZ/TeamsStatus: Monitoring your Microsoft Teams status with PowerShell

pls use sensor.teams_activity in the input.

blueprint:
  name: Mute mediaplayer when Teams calling.
  description: >
    Mute a mediaplayer when Teams rings or is calling.
    Only when person is home and the mediaplayer is playing.
  domain: automation
  input:
    teamsactivity:
      name: teams_activity
      description: teams activity
    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 teamsactivity
    to: "In a call"
  - platform: state
    entity_id: !input teamsactivity
    to: "In a meeting"
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.volume_mute
    entity_id: !input media_player
    data:
      is_volume_muted: true
  - wait_for_trigger:
    - platform: state 
      entity_id: !input teamsactivity
      to: "Not in a call" 
    timeout:
      seconds: 300
  - service: media_player.volume_mute
    entity_id: !input media_player
    data:
      is_volume_muted: false
4 Likes