Music Assistant automation

Hey Guys.
I really dont know how to go about this but perhaps someone can give me a hand?

I would like to have Music Assistant playing the playlist “background” on a loop to a chromecast speaker group when “Camera 1 Motion Alarm” detects motion and continue for 60min then stop/pause if there is no motion detected, then resume again when motion detected.

Im sure this should be pretty trivial to make but i really dont know how to go about it.

any pointers or help is appreciated :slight_smile:

Something like this maybe. Not tested so can’t say it will work.

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - binary_sensor.your_motion_detector
    from: "off"
    to: "on"
condition: []
action:
  - service: media_player.play_media
    data:
      media_content_type: your playlist
    target:
      entity_id: media_player.chromecast
  - delay:
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
  - service: media_player.media_stop
    data: {}
    target:
      entity_id: media_player.chromecast