How Action, after X's minutes not movement?

Hello, I have movement sensor of Xiaomi, and I want that the light of the kitchen turns OFF, after 15 minutes, of NO MOVEMENT, basically when the sensor is OFF for 15 minutes, after changing from ON to OFF…
But I’m not able, anyone could help me?

Thanks

This might help you…

Xiaomi sensors have an attribute No motion since that you can use. You can use a template trigger with the following template.
{{states.binary_sensor.motion_sensor_158d00016daecc.attributes["No motion since"] > 900}}

This will return true if there has been no motion for more than 15 minutes.

Just make :
trigger:
plaform: state
entity_I’d: sensor.xxxxx
from: 'on
to: ‘off’
for: 00:15:10
action:

I’ll try… thanks, But, that counts from first, ON to OFF, if between, there’s a OFF to ON, and another ON to OFF, it should work? anyway?

Thanks… :smile: