Issue with motion sensor trigger and condition

I have a Sonos speaker that I activate to play web-radio when I enter the bathroom. This is triggered by a motion sensor in the bathroom.

There is equally a second automation that triggers if there was no motion for 10 minutes, then the radio is turned off. Both work as expected.

The issue I am facing is the following. Obviously, you move around in the bathroom so while you are there, there is often motion, and as such the automation is triggered to play the radio. At this point, it is actually already playing,so triggering it again would cause it to re-buffer the radio and this causes a pause in the playing.

So I need to add a condition that it can only start playing if there was no motion for 10minutes. (at that point in time the previous automation would have triggered and turned it off)

but adding that condition makes it so that it actually never starts playing. So I’m having issues with correctly defining the 10m of inactivity condition.

I have played around with adding a condition to only start playing when the speaker was in ‘paused’ mode, and that works, it doesnt trigger multiple times, but sometimes my wife doesnt want to listen to the radio, turns it off, but then the condition doesnt apply anymore and the radio starts playing again on motion :slight_smile:
So it seems adding that 10m of no motion is the best condition I Can use, except that it doesnt work. If I Add that, the radio never starts playing.

Any help is highly appreciated. Please find my attempt below

alias: "Bathroom : start play on motion"
description: ""
trigger:
  - type: motion
    platform: device
    device_id: 8e19029fadc94572978bcd509c85b31b
    entity_id: binary_sensor.motion_sensor_motion_detection
    domain: binary_sensor
condition:
  - condition: state
    entity_id: binary_sensor.motion_sensor_motion_detection
    state: "off"
    for:
      hours: 0
      minutes: 10
      seconds: 0
    enabled: true
 action:
  - service: media_player.play_media
    target:
      entity_id: media_player.eetkamer
    data:
      media_content_id: media-source://radio_browser/cdf1baaf-ed22-41c5-8c9e-90b4133fda8f
      media_content_type: audio/mpeg
    metadata:
      title: Joe 80's & 90's
      thumbnail: https://static.mytuner.mobi/media/tvos_radios/x7fzbddfxjqy.jpg
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://radio_browser
        - media_content_type: music
          media_content_id: media-source://radio_browser/country/BE
    enabled: true
  - service: media_player.volume_set
    data:
      volume_level: 0.1
    target:
      device_id: cec76e5b1e4f4b62bcb417bc92d32b9b
    enabled: true

How about a timer helper, started at the same time as the light? The radio could then come on when the timer started (not the movement sensor) and turn off when the timer finished.

No, sorry, doesn’t work - each movement would start the timer again.

I ‘fixed’ my own issue. So adding it here for context.

I added a step in the actions to disable the automation to start the radio playing.
In the other automation, that stops the playing after 10 minutes, I added a step that enables the previous automation again.

So with this in place, the automation to start playing cannot be triggered again, unless we have passed the 10 minutes of no activity.

Hope this helps for anybody else.