User last active / seen

Is there a way to tell when a user was last active in Home Assistant?

I am looking for a way to trigger an automation to send an email if I haven’t been active in Home Assistant for a week.