All of my automatons with that configuration still work. Perhaps it’s your formatting. Make sure it appears like this (use code blocks as asked at the top of every forums page when posting your configuration)
Here is one of my working automations.
# MOTION SENSOR 1 - OFF # - alias: Motion Sensor 1 - Off hide_entity: true trigger: platform: state entity_id: binary_sensor.motion_1 to: 'off' for: minutes: 2 seconds: 30 action: service: light.turn_off entity_id: light.bathroom