Isn’t this a variation of the motion activated lights automation in the Cookbook?
As a starting point…
triggers:
- trigger: state
entity_id: light.bathroom_light # change this
to: 'on'
for:
minutes: 15
- trigger: state
entity_id: light.bathroom_light # change this
to: 'off'
actions:
- action: "switch.turn_{{ trigger.to_state.state }}"
target:
entity_id: switch.bathroom_fan # change this
Another option would be to have an input_boolean flag that is turned on when the light has been on for 15 minutes, then use that as a condition in an automation triggered by the light turning off.
Or… Trigger when the light has been on for 15 minutes, then wait for trigger with the light going off.