Alarm Masking

Hi all,
I’m after some guidance on something I’ve tried to implement which works but is somewhat clunky and I’m wondering if anyone’s overcome it in a better way.

I’ve basically got several CCTV cameras, these each have an array of different detection alarms.
image
I’ve also got several PIR and contact type sensors.

What I’m after is a way to take a group of binary sensors and visually select whether they need to be included in a common alarm sensor.
e.g. of all the alarms for my camera I’d like to list these and then select which detection methods I’d like to contribute to a single detection alarm from that camera.
As it stands I’ve done all of this by using an automation where I list all the inputs I’m interested in and it then toggles a binary helper. It works, but each camera needs a bespoke automation to do this and there’s no way to alter it without changing the automation.

I’m then also after a similar system where I can visually chose which of these combined alarms will then trigger an alarm to my mobile, or pop up a feed on the screen or just be ignored.
Again with automations I’ve achieved this together with an array of helpers to identify if these are active or inactive.

So, what I’ve come up with is this:-

It all works, but as I said it’s very clunky, not very easy to tweak or expand without re-writing automations and I’m sure that there’s better way of doing some if not all the parts of it.
There’s something at the back of my mind from uni when we looked at bitwise AND gate which might somehow make this work, ie if the incoming sensors were organised as a byte of information and then ANDed with another byte that represented the alam selection/mask I’d end up with an outcome that represented a number which if >1 would mean the alarm was active or 0 if it wasn’t.

Anyone any ideas?

Have you looked at Alarmo?

I have a similar implementation using templates to combine things together rather than auromations and a dashboard like your to enable / disable alert detection.

To make it manageable, I use shell scripts to generate the HA configuration (packages, automations, displays). At a simple level I write the package once, run it through search/replace to substitute new entity ids / config in.

For example, this creates an alert if the garage door is open and no motion has been detected in the garage for 600 seconds and announces it on a Sonos speaker in addition to sending a telegram alert and have an ability to enable / disable.

door_open_duration_alert garage_door_1 binary_sensor.garage_sensor_motion_detected 600 yes "garage overhead"

And this UI appears (I like your styling better, never been a great UI guy) - lovelace_gen is really good.

The benefit is if change the base template I rerun the scripts and all my existing stuff gets upgraded with the new capability. I also run HA in two separate houses so having the config and UI generated consistently is super helpful.