Turn on tv but only if it's off and no one is in the room for 30 minutes

Hi,
I’m trying to figure out this automation. Turning on the tv when a person comes in the room, but only if there was no motion for 30 minutes in the room before. This leave times for people to leave the room, read a book etc. The other condition is for the TV to be off.

It’s not working as expected, it’s not turning on at all and i suspect the 30 minute condition is invalidated the moment it detects motion, something like that. It looks fine to me but something is not right clearly.

What would be the right way of doing this one ?

Many thanks…

- id: '1638181275878'
  alias: Entertainment on
  description: Turn on TV and Console if motion was detected, but only if no motion
    was detected for 30 minutes
  trigger:
  - type: motion
    platform: device
    device_id: 27292a247e8f2a22561aedaba518aba6
    entity_id: binary_sensor.living_room_motion_sensor_1_motion
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  condition:
  - condition: device
    type: is_off
    device_id: 27292a247e8f2a22561aedaba518aba6
    entity_id: switch.living_room_motion_sensor_1_motion
    domain: switch
    for:
      hours: 0
      minutes: 30
      seconds: 0
  - condition: state
    entity_id: media_player.viera_et60_series_2
    state: unavailable
  action:
  - service: notify.alexa_media_living_room
    data:
      message: Entertainment on
      data:
        type: tts
        method: all
  - scene: scene.tv_power
  mode: single