Alarm system with Domoticz works very well!

Moderator: leecollings

Post Reply
User avatar
psubiaco
Posts: 194
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

Alarm system with Domoticz works very well!

Post by psubiaco »

Hi,
at https://github.com/CreasolTech/domoticz_lua_scripts you can find some scripts for Domoticz.
In particular, you can find the following 4 files, to be placed into domoticz/scripts/lua , that can be used to get a complete alarm system, that manages magnetic contact sensors, PIRs, tampers, sirens, and much much more.

alarmSet.sh
alarm_config.lua
alarm_sendsnapshot.sh
script_device_alarm.lua

Everything can be controlled by smartphone/browser through the domoticz web interface, and all notifications are sent to a Telegram group (with you and your familiars).
alarm_config.lua is used to configure sensors/siren stuff and Telegram chatid/key.
alarmSet.sh is a script that can be called by a scene/group to set the alarm in 4 different modes:
1=OFF
2=DAY (no sirens, just send notification when a door/window/blind/PIR was opened
4=NIGHT (use only internal sirens, to not disturb neighbours case of alarm)
8=AWAY (activate both internal and external sirens in case of alarm)

The script_device_alarm.lua is customized to send some short video on Telegram when external PIRs/radar will be activated (IPCams are needed, for this function): in this way it's possible to control is someone (or a cat!!) is walking around your building.

The reason why I publish my scripts is that alarm system by Domoticz and this script is fully customizable, and has nothing less than a commercial alarm system.
If you need some explanation, don't hesitate to ask and I'll make a short doc in the next days.
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
sputnik3
Posts: 3
Joined: Tuesday 21 July 2020 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Torelló
Contact:

Re: Alarm system with Domoticz works very well!

Post by sputnik3 »

thanks for the info now i look at it
User avatar
psubiaco
Posts: 194
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

Re: Alarm system with Domoticz works very well!

Post by psubiaco »

sputnik3 wrote: Monday 07 December 2020 17:07 thanks for the info now i look at it
Hi Sputnik3,
did you tried alarm lua script?
Any suggestions/feedback?
Thanks
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
marktn
Posts: 233
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: Alarm system with Domoticz works very well!

Post by marktn »

Looks good!
How do you switch on and off the Alarm? Working on a other project at this moment, this will be my next :D
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
lost
Posts: 616
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Alarm system with Domoticz works very well!

Post by lost »

marktn wrote: Saturday 08 May 2021 15:01 How do you switch on and off the Alarm?
Not the author, but looks this is done by scenes using a defined name. Activation device for each scene is then up to the user (some switches, remote keys...).

A switch name may have been set directly in the script, but I suppose using a scene allows to use any switch name (as scene trigger) without modifying script code (but some sensors name may require this anyway).

Integrated security panel may have been another option. The alarm wiki also give good tips (like prefixes naming conventions for detectors, allowing to add some new ones without script modification) I used in my system. Plus some others resulting from forum discussions: Alarm additive weighting mechanism was a good tip. I did this over a sliding minute as this fits well with types prefixes: 1 prefix = 1 base sensor weight. Simple & useful mechanism for rejecting false positives, especially for external sensors that can then use a base weight under siren triggering threshold => several triggers needed in the sime slice, thus cat/bird passing by will not ring the bells).

Still have an exception to manage for my garage, like the author. Could have used some delayed trigger pre-prefix there that may apply to any sensor type!

On my side, I have these prefixes:
-Opn = Open, for door/window sensors ; presumed reliable thus base weight = threshold.
-Mvt = Movement, theses are PIRs located inside my home/garage/under my roof (some burglars gets in from the roof after removing tiles over inhabited areas) ; also presumed reliable (with some sensitivity tuning if animals are there) thus base weight = threshold.
-Prm = PIRs located outside (perimeter sensors), not (so) reliable so weight = 1/3 threshold.
-Cam = This one (cameras) is a bit tricky, using Domoticz virtual switches feature so they are in fact Virtual PIRs, feed by an external service managing IP cameras, with this time a variable base weight derived from image capture nb over a 10s FTP check time slice.
-Jam = Jamming, for radio sensors. On my side this is a virtual switch driven by loss of sight of my z-wave AC powered (thus will never sleep) and battery backed siren: Even if power fails, if this device can't be reached this is abnormal (I posted the setup in the alarm wiki). Base weight = threshold (reliable, false positives are filtered by control script).

So that's 5 types/prefixes.

Should have added a pre-prefix like Dly to allow delaying detection report a few seconds when needed for any sensor type: I know alarm deactivation by smartphones BT detection may be delayed until metallic garage door is opened, thus my OpnGarage may have been named DlyOpnGarage to allow managing this without using a full switch name that have to be setup in script. Well, only have one such exception for now, so my laziness still wins!

Don't manage several zones/times like the author, only Presence/Away. But weighting mechanism allows me to manage 2 alarm activation thresholds:
-1st, set at half full alarm threshold, will only activate siren for 5s (= You're detected, go away if you're smart!).
-2nd will start siren for 5mn.

This also avoids disturbing too much neighborhood if sensitivity tuning/weight setup trade-offs are sometime beaten (on a sunny+windy day, outside cams can be a bit verbose with false captures even with good internal motion detection setup ; at night spiders may be attracted by IR light...).
Rudi52
Posts: 4
Joined: Tuesday 13 November 2018 20:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Alarm system with Domoticz works very well!

Post by Rudi52 »

I installed this script. For trying out i only use one MCS-sensor.
When i activate the sensor, i get an alam, even if all scenes AlarmAway, AlarmNight and AlarmDay are off.
When i set AlarmAway to on, the message stays the same:
LUA: ALARM Day: MCS_Zigbee stopcontact changes to On
LUA: Alarm activated by MCS_Zigbee stopcontact

I filled in the config_alarm.lua as follows: ALARMlist={
-- AlarmLevel: Name, Tampers PIRs en. MCS1 en. MCS2 en.
[0x01]={'ALARM OFF', 0xffffffff, 0x00000000, 0xffffffff, 0x00000000},
[0x02]={'ALARM Day', 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff},
[0x04]={'ALARM Night', 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff},
[0x08]={'ALARM Away', 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff},
[0x10]={'ALARM Test', 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff},
}
-- List of magnetic contact sensors (window/door + associated shutter/blind)
-- Magnetic sensors name must start with MCS prefix
MCSlist={ -- MCS_window/door, MCS_shutter, delay
{'MCS_Zigbee stopcontact','',0,}, --00000001
When the MCS is activated and it does not matter what the status is of the scenes, i get an alarm in the logfile, but also a pushmessage on Telegram:
Domoticz logfile:
User: Admin (IP: 192.168.1.169) initiated a switch command (11/MCS_Zigbee stopcontact/On)
LUA: ALARM Day: MCS_Zigbee stopcontact changes to On
LUA: Alarm activated by MCS_Zigbee stopcontact
Why is the alarm activated while all scenes are off?
User avatar
amplituda
Posts: 24
Joined: Thursday 23 August 2018 14:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Finland
Contact:

Re: Alarm system with Domoticz works very well!

Post by amplituda »

Hello, is it possible to see a very simplified version that will simply send a short piece of video to Telegram? There is one door opening sensor - when triggered, a video of an example of 5-10 seconds is sent. I couldn’t figure out how to simplify the script myself) thanks
User avatar
jjnh
Posts: 33
Joined: Sunday 09 December 2018 14:06
Target OS: Linux
Domoticz version: 2023.1
Location: Netherlands
Contact:

Re: Alarm system with Domoticz works very well!

Post by jjnh »

Odroid N2+ 4GB, with an RfxTrx433E, Zigbee with Slaesh's CC2652RB, Z-Wave, BroadLink IR using RM mini 3 and P1 connected.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests