Simpler/best way to make binary sensor become TRUE if light entity X has been on for longer than Y minutes

So far, I’ve used a template sensor with trigger platform using “for” X minutes and also handling the case of restarts.
But is there anything out of the box that HA provides that’s simpler? Thanks!

EDIT: I’m asking because I’m about to add a bunch of such sensors (4-5) and want to make sure I’m doing it right. It’s almost like I need a blueprint for a template sensor :laughing:. Or if there’s a “Helper” HA type of sensor that comes out of the box, I’d just use that to avoid a lot of duplication.

See delay_on property of template binary sensor:

Thanks I think Tom had mentioned that in another post I had.
This does simplify the logic a bit!

Maybe the question should be, why do you need it as a binary sensor? For automations you can just as easily put the for in the automation. There are situations where the binary sensor is useful, but not that many I can think of.

Thanks. I think it is a nice way to abstract details of what I consider “too long” to trigger the binary sensor.
I have at least 3 places I want to reference that. So instead of hardcoding in 3 places what I consider (today) for something to be on “too long”, I can hide that condition behind a logical sensor that says “is this condition of being over-the-top” true - and then build logic on top of that without being concerned how that’s determined. I can then change my mind about those details and everything will continue to working correctly.

1 Like