nielsfaber / alarmo

Easy to use alarm system integration for Home Assistant
1.37k stars 120 forks source link

[Feature Request] - Trigger alarm only when 2 or more sensors are triggered #147

Closed LeoGr13 closed 3 years ago

LeoGr13 commented 3 years ago

With motion sensors there is always a possibility for false alarms. It would be a nice to have feature that the alarm will only be triggered, if 2 or more motion sensors are triggered at the same time or within a given time period.

CommittotheIndian commented 3 years ago

I agree with this. I have Sonoff motion sensors and currently can not use them due to all the false triggers.

samvanh commented 3 years ago

Instead of relying on a component to fix your faulty sensors, isn't it a better option to make sure that your sensors work as they should? Think your request is out of the scope of this component.

LeoGr13 commented 3 years ago

Dear internetwarrior, motion sensors are never a 100% solution, there is always a chance of wind, insects directly in front of them or other things you are not able to manage. That is why most modern business alarm solutions rely on multiple triggers within a given time period, when using motion sensors. These sensors are not faulty, they were designed to capture motion and there is always a small chance of motion.

I realized the feature alredy with an additional automation and a template binary sensor, which is then used by alarmo. If someone is interested, I will share with pleasure.

dannymertens commented 3 years ago

Dear internetwarrior,

motion sensors are never a 100% solution, there is always a chance of wind, insects directly in front of them or other things you are not able to manage. That is why most modern business alarm solutions rely on multiple triggers within a given time period, when using motion sensors.

These sensors are not faulty, they were designed to capture motion and there is always a small chance of motion.

I realized the feature alredy with an additional automation and a template binary sensor, which is then used by alarmo. If someone is interested, I will share with pleasure.

Hi,

Sounds very interesting hope you can share some more details how you did this?

Thanks!

CommittotheIndian commented 3 years ago

Dear internetwarrior, motion sensors are never a 100% solution, there is always a chance of wind, insects directly in front of them or other things you are not able to manage. That is why most modern business alarm solutions rely on multiple triggers within a given time period, when using motion sensors. These sensors are not faulty, they were designed to capture motion and there is always a small chance of motion.

I realized the feature alredy with an additional automation and a template binary sensor, which is then used by alarmo. If someone is interested, I will share with pleasure.

I would be interested in your automation and template sensor if you wouldn't mind posting.

Thanks,

LeoGr13 commented 3 years ago

I need to say, that there is obviously a much more efficient way to achive something like this, but Im quite new to Homeassistant and YAML and therefore I try to use the graphic overlay for automations as much as I can.

I did that with 2 helpers, 4 automations and 1 template sensor :D

1st helper: Navigate to settings and go to helpers, create a counter helper with a name something like "alarm helper" min: 0 max: 99 start: 0 step size: 1 entity-id: counter.alarm_helper

2nd helper: is an input boolean. Name it "Dummy Sensor Alarmanlage" and entity: input_boolean.dummy_sensor_alarmanlage

Template Sensor (needed to transform your input boolean to a binary sensor for alarmo): start file editor and add these lines to your configuration.yaml:

binary_sensor:
  - platform: template
    sensors:
      dummy_binary_alarmanlage:
        value_template: >-
          {{ states.input_boolean.dummy_sensor_alarmanlage.state }}

1st automation: create an automation and add all of your desired motion sensors as triggers. for the action you want to start a service: service: counter.increment target: "Alarm Helper" or entity-id counter.alarm_helper

2nd automation trigger is now a numerical state: entity: counter.alarm_helper over: 1 (if you want your alarm only after 3 motion sensors triggered, you need to put over 2 and so on) action is now another service: input_boolean.turn_on target: "Dummy Sensor Alarmanlage" or entity: input_boolean.dummy_sensor_alarmanlage

3rd automation: trigger is another numerical state: entity: counter.alarm_helper under: 2 (if you want your alarm after 3 motion triggers, you need to put under 3 and so on) action is service: input_boolean.turn_off target: "Dummy Sensor Alarmanlage" or entity: input_boolean.dummy_sensor_alarmanlage

4th automation: trigger is another numerical state: entity: counter.alarm_helper over: 0 for: 00:02:00 (set your desired time period here, I choose 2 motion sensors triggered within 2 minutes) action is service: counter.reset target: "Alarm Helper" or entity: counter.alarm_helper

last step: add your template sensor, in my case "dummy_binary_alarmanlage" to your alarmo system and remove the motions sensors you used in your 1st automation

It is obviously not the most efficient way to achive something like this but it works flawlessly

dannymertens commented 3 years ago

I need to say, that there is obviously a much more efficient way to achive something like this, but Im quite new to Homeassistant and YAML and therefore I try to use the graphic overlay for automations as much as I can.

I did that with 2 helpers, 4 automations and 1 template sensor :D

1st helper: Navigate to settings and go to helpers, create a counter helper with a name something like "alarm helper" min: 0 max: 99 start: 0 step size: 1 entity-id: counter.alarm_helper

2nd helper: is an input boolean. Name it "Dummy Sensor Alarmanlage" and entity: input_boolean.dummy_sensor_alarmanlage

Template Sensor (needed to transform your input boolean to a binary sensor for alarmo): start file editor and add these lines to your configuration.yaml: binary_sensor:

  • platform: template sensors: dummy_binary_alarmanlage: value_template: >- {{ states.input_boolean.dummy_sensor_alarmanlage.state }}

1st automation: create an automation and add all of your desired motion sensors as triggers. for the action you want to start a service: service: counter.increment target: "Alarm Helper" or entity-id counter.alarm_helper

2nd automation trigger is now a numerical state: entity: counter.alarm_helper over: 1 (if you want your alarm only after 3 motion sensors triggered, you need to put over 2 and so on) action is now another service: input_boolean.turn_on target: "Dummy Sensor Alarmanlage" or entity: input_boolean.dummy_sensor_alarmanlage

3rd automation: trigger is another numerical state: entity: counter.alarm_helper under: 2 (if you want your alarm after 3 motion triggers, you need to put under 3 and so on) action is service: input_boolean.turn_off target: "Dummy Sensor Alarmanlage" or entity: input_boolean.dummy_sensor_alarmanlage

4th automation: trigger is another numerical state: entity: counter.alarm_helper over: 0 for: 00:02:00 (set your desired time period here, I choose 2 motion sensors triggered within 2 minutes) action is service: counter.reset target: "Alarm Helper" or entity: counter.alarm_helper

last step: add your template sensor, in my case "dummy_binary_alarmanlage" to your alarmo system and remove the motions sensors you used in your 1st automation

It is obviously not the most efficient way to achieve something like this but it works flawlessly

Hi Thanks,

Looks very interesting going to look in to it and think this will be just perfect for what I have in mind, thanks!

As a non developer and also more or less new to HA, I completely understand what you mean, and we think alike I'm also building a lot of things with helpers ;-) I agree probably not the best solution but hey it works and to be honest is quite powerful.

Build a small notification sender (https://community.home-assistant.io/t/simple-option-to-send-tts-message-to-internal-speakers-google-sonos/290409) for the house also completely with helpers and simple automations, but as always when you get something working you find more things you want to do, so now working on a new version that gives me the option to send TTS messages, Text messages, AndroidTV notifications, option for different notification services, (TTS, Synology chat, Telegram, HA app... groups of devices, trying to create all the automations with blueprints for easy reproduction but pff not that easy if you're not a developer to be honest ;-)

I only wish the HA team added the option to group helpers, automations, scripts in to folders because after about 60 helpers, 150+ automations, 60+ scripts is getting a mess to find everything back sometimes :-P

Thanks!

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days