Ability to disable an alert - worth a CL?

Hi, I was considering modifying the Alert class (core/homeassistant/components/alert) to add the ability to disable an alert, either indefinitely or for a fixed period of time (ie, snooze). Any opinions?

A use case is a water-leak binary_sensor that is just a little wet, and so frequently switches on and fires the alert. "Ack"ing the alert doesn’t help because it is frequently retriggering.

You could work around this by adding another binary_sensor that tracks whether the underlying leak binary_sensor has fired in the last X minutes, but that doesn’t seem to quite capture the desired behavior.

Or you could use an automation instead of an alert, but then you miss out on the alert machinery, particularly the ability to set varying delays, and it seems like slightly the wrong abstraction.

Thoughts?
-Josh

1 Like

I work around this by ANDing the alert template binary sensor with an input boolean to enable or disable the alert. Easy to do, clear in the alert logic what is happening, and easy to add to a single card for managing alerts in the UI.

Yeah, that certainly works.
I decided to write some code to see what was possible and ended up with a pull-request that adds the ability to disable or snooze alert notifications for a specified period of time. The alert will still fire and can still be ack’d, so alert status and history is preserved for diagnostics.
Pull request: Add ability to disable/snooze alert notifications by redstone99 · Pull Request #89181 · home-assistant/core · GitHub

There’s probably a way to accomplish this behavior using additional scripts/automations/input-entities. Though, I think the experience is better if it’s part of the Alert entity.

I’d also like to improve the alert info shown on the more-info popup in lovelace, but I’ll first see how the PR is received.