Alarm Trigger Option for Sensors (possibly even for more components type)

Hi there,

While working here and there on my HA instance I figure that to have an Alarm system configured to manage different sensors based on different arming state, it takes forever… therefore I had an idea that might be helpful.

It might be useful to have, on a sensor definition level, an optional option to define if this sensor trigger an alarm, and in which state.

For example, let’s say we are configuring a PIR which sits inside the house and you want it to trigger the alarm when in away and night mode

trigger_alarm:
  - armed_away
  - armed_night

This way what we will need to do is only manage the actions that will be perform based on the alarm armed state.

And of course, sensors (or components) that have no this option, will no trigger the alarm.
Users will still be able to use automations to trigger alarm based on components status, but this might make things easy, specially when there are many sensors.

This should be an option for every type of sensor, not sure it makes sense (it might) for other type of components.

It might be that I didn’t think about every possible outcome, if so, feedback are welcome :slight_smile:

Andrea

If you are struggling setting up an alarm system, have a look at this custom component. Scroll to the end of the thread to see the new version. It has lists of sensors you pick for each alarm mode.

Hi Tom,
thanks for that, I will definetely take a look :slight_smile:

I still think that having the ability to set on each sensor what do they trigger can be a nice/useful feature :slight_smile:

Cheers

Andrea

Would using groups be easier than creating a new sensor attribute?

I disagree. It really does not fit in with how HA works. Sensors are sensors, not automations.

I am not saying that sensor are automation, but that when you defined them you can directly “assign” them to a specific arm state as triggers without having to modify different automations (or a group) whenever you have a new sensor.

Simply that :slight_smile:

Well whenever you have a new sensor you still need to create the sensor configuration.

A group comes to handy to don’t have to modify (most of the time at least) multiple automation based on those sensor to trigger the alarm, but it would still means modify multiple file everytime you have to add 1 sensor (or remove or modify)

This is the area of activity assigned to automations not sensors.

I do understand but not agree 100% :slight_smile:

To be would simply means to make things easier and the system more flexible, it still can be a two way configuration rather than one way.

Having multiple ways to achieve one result is a way of doing things smart :slight_smile:

Still, this is my own opinion, everyone of course can have different point of view based on different experience

Andrea

Not sure what you mean. In HA a sensor is a sensor, nothing to configure.

you could use the hombridge name attribute, set it to homearm or awayarm and use your automation to look it up.

By sensor I mean devices as motion sensor, door/window sensor and so on.

That might be a workaround I guess :slight_smile:

I understand but you write you still need to create the sensor configuration while currently there is nothing to configure for a sensor as far as I know.

Not sure what sensor you use, I guess it might be different.

For instance, I use Sonoff PIR sensors that use Sonoff RF Bridge to communicate (Tasmota Firmware) to HomeAssistant using MQTT, and to have that sensor available in HA I need to create the configuration file for that sensor with mqtt platform, state topic, availability topic and so on.

So, I figure that if I am creating that file for that sensor (binary_sendor in this case), it might be useful to specify what alarm mode it needs to trigger when a “on” payload is received

btw, you can use SetOption 19 on the Tasmota console to have HA auto discover your PIR sensors and save you setting up the config file.

Yes I know, but I do prefer not to use autodiscovery but rather to manually configure my system to match names and structure of my choise.

Actually also to best manage backups and scripts :slight_smile:

Andrea