Time in state since last event? (Emptying the vacuum bin)

I’m terrible about remembering to empty the bin for my vacuum, but the Ecovacs N79s doesn’t put out an error for bin full.

I’m looking for a history_stats template that would measure the time the vacuum is in the auto state since I last cleaned the bin. (From there I could probably have an automation notify me if it’s been too long since I’ve emptied it.)

Had a lot of issues making templates in the past, and the documentation isn’t that helpful to a non-programmer.