5 Automations with Media Players in Home Assistant


Media players give great automation options with Home Assistant, the following ideas and example are to give you some inspiration for your own automations!

Camera Stream

alias: Play Stream Doorbell
description: ""
trigger:
  - platform: device
    device_id: 1921c6edd5a36ff852987602f898c921
    domain: nest
    type: doorbell_chime
condition: []
action:
  - service: camera.play_stream
    data:
      format: hls
      media_player: media_player.chrome_cast
    target:
      entity_id: camera.front_door
mode: single

Switching HDMI source

alias: Garden Motion
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.garden_detections_person
    from: "off"
    to: "on"
condition:
  - condition: state
    entity_id: binary_sensor.patio_doors
    state: "off"
  - condition: state
    entity_id: media_player.living_tv
    state: playing
action:
  - service: notify.mobile_app_giordano_s_iphone_12
    data:
      message: Someone might be in the garden
      title: Keep an eye out
  - service: media_player.select_source
    data:
      source: Protect
    target:
      entity_id: media_player.living_room
mode: single

Volume Control (Night Time)

Day Time Volume

alias: Day Sounds
description: ""
trigger:
  - platform: time
    at: "07:00:00"
condition: []
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.sonos_kitchen_night_sound
        - switch.sonos_lounge_night_sound
  - service: media_player.volume_set
    data:
      volume_level: 0.2
    target:
      entity_id:
        - media_player.kitchen_sonos
        - media_player.lounge
mode: single

Night Time Volume

alias: Night Sounds
description: ""
trigger:
  - platform: time
    at: "21:00:00"
condition: []
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
        - switch.sonos_kitchen_night_sound
        - switch.sonos_lounge_night_sound
  - service: media_player.volume_set
    data:
      volume_level: 0.1
    target:
      entity_id:
        - media_player.kitchen_sonos
        - media_player.lounge
mode: single

Ambience Light

alias: Movie in Living Room
description: ""
trigger:
  - platform: state
    entity_id: media_player.atv_living_room
    to: playing
condition:
  - condition: sun
    after: sunset
action:
  - scene: scene.movie_scene
mode: single

Pausing Vacuuming

alias: Pausing Vacuum when watching TV
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.atv_kitchen_apple_tv
    to: playing
condition:
  - condition: state
    entity_id: vacuum.robot_vacuum
    state: cleaning
action:
  - service: vacuum.return_to_base
    data: {}
    target:
      entity_id: vacuum.robot_vacuum
mode: single

Gio

Gio loves rabbits, smart home tech, WWII, travelling to Thailand & my favourite pizza is margherita with parma ham!

Recent Posts