Triggering a script when there has been no motion after a certain time

I’m trying to move all my smartthings automations into either home assistant natively or node red.
One thing I haven’t figured out yet, is how to arm my alarm/set home to night when there has been no action on specific motion sensors for 15 minutes, starting at 11am.

Any suggestions on how to wire that up?

Thanks!

Something like this is how I do things when motion has stopped:

# if hallway lights are on and motion has gone
#   - turn hallway lights off
#
- alias: "Lights - Turn Hallway Light Off If Motion Gone"
  trigger:
    - platform: state
      entity_id: sensor.hallway_motion_sensor
      to: 'OK'
      for:
        seconds: 90
  condition:
    - condition: state
      entity_id: light.hallway
      state: 'on' 
  action:
    - service: homeassistant.turn_off
      entity_id: light.hallway

This is close, but what I realize I Didn’t explain well was the time factor. I want it so that after 11pm is hit, and there has been no action for lets say 20 minutes, trigger script. As in, If there was no action from 10:50pm, it would trigger at 11:10pm. Thats optimally what I want, but I guess I’d also take the timer starting at 11pm no matter what (triggering at 11:20). How do you tweak it from there?

you should add an additional ‘time’ condition like

condition: time
  after: '23:00'