Prerequisits
- Domoticz v3.8837 or later
Moderator: leecollings
Let's hope that you are back on the track again soon @EdwinK
Code: Select all
alarmNagOpenSensors = function(domoticz, alarmZone, nagSensors, lastValue)
if alarmZone.name == 'My home' then
if #nagSensors == 0 and lastValue > 0 then
domoticz.log('The previously reported sections are now closed! Good work!', domoticz.LOG_INFO)
elseif #nagSensors > 0 then
local msg = ''
for _, sensor in ipairs(nagSensors) do
if msg ~= '' then msg = msg..' and ' end
msg = msg..sensor.name
end
msg = 'Open sections in zone: '..alarmZone.name..'. '..msg
domoticz.log(msg, domoticz.LOG_INFO)
end
end
end,
Code: Select all
alarmOpenSensorsAllZones = function(domoticz, alarmZones)
-- Toggle the big red lamp if there are any open sensors in 'My House'
for _, alarmZone in ipairs(alarmZones) do
if alarmZone.name == 'My House' then
if (alarmZone.openSensorCount > 0) then
domoticz.devices('Big Red Lamp').switchOn()
elseif (alarmZone.openSensorCount == 0) then
domoticz.devices('Big Red Lamp').switchOff()
end
end
end
end,
Thanks for your kind words and for the suggestion @papoo.
Hi Andrèsdressie wrote: ↑Monday 28 August 2017 14:47 Thanks for your work! Past weekend I installed it on my test Domoticz to play around, and it looks good!
I want to use it on my main server but I have a few questions:
-how do you add another zone?
-can you also create a "Secure-Home" mode, so you can move around in your house without setting off the alarm (only protect the doors for example)?
Thanks again!
Grt,
Andrès
If You look here, you can find 2 different configuration examples. One of them has 2 zones defined.
Yes, you can arm in 2 different modes. The arming mode "Armed Home" is typically used for arming when home. If You have motion detectors or other sensors in your home that you wish to exclude, you just define them as SENSOR_CLASS_B (See config example file again) Then they won't trigger any alarms while "Armed Home". (But if you arm as "Armed Away" they will!)
Hi!
Below an example that just sends a notification when an alert occurs. You can customize it to suit your needs. Just add code to activate your scene in it.The Wiki wrote:Every installation is unique and has it's own needs. Therefore ideAlarm has a number of alarm events that will trigger your custom script functions (if you choose to define them). That way you can choose whatever shall happen on those events. You define your custom scripts as helper functions in the event helpers file. Your helper functions will typically be able to access an alarm zone object that holds various information and provides functions about the alarmZone that is being processed.
Code: Select all
alarmZoneAlert = function(domoticz, alarmZone, testMode)
-- It's ALERT TIME!
local msg = 'Intrusion detected in zone '..alarmZone.name..'. '
for _, sensor in ipairs(alarmZone.trippedSensors(domoticz, 1)) do
msg = msg..sensor.name..' tripped @ '..sensor.lastUpdate.raw..'. '
end
-- We don't have to turn On/Off the alert devices. That's handled by the main script.
if not testMode then
domoticz.notify('Alarm Zone Alert!',
msg, domoticz.PRIORITY_HIGH)
else
domoticz.log('(TESTMODE IS ACTIVE) '..msg, domoticz.LOG_INFO)
end
end,
Code: Select all
--activate my scene
domoticz.setScene('Evening lights', 'On')
Code: Select all
017-09-29 14:41:15.200 Error: dzVents: Error: .../local/domoticz/var/scripts/dzVents/scripts/ideAlarm.lua:13: module 'ideAlarmModule' not found:
no field package.preload['ideAlarmModule']
no file '/usr/local/domoticz/var/scripts/dzVents/modules/ideAlarmModule.lua'
no file '/usr/local/share/lua/5.2/ideAlarmModule.lua'
no file '/usr/local/share/lua/5.2/ideAlarmModule/init.lua'
no file '/usr/local/lib/lua/5.2/ideAlarmModule.lua'
no file '/usr/local/lib/lua/5.2/ideAlarmModule/init.lua'
no file './ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/runtime/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/runtime/device-adapters/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/dzVents/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/scripts/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/generated_scripts/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/data/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/ideAlarmModule.lua'
no file '/usr/local/domoticz/var/scripts/dzVents/ideAlarmModule.lua'
no file '/usr/local/lib/lua/5.2/ideAlarmModule.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './ideAlarmModule.so'
Code: Select all
2017-09-30 16:06:47.549 Error: dzVents: Error: ideAlarm V2.0.3: There is no device with that name or id: Security Panel
2017-09-30 16:06:47.550 Error: dzVents: Error: ideAlarm V2.0.3: An error occured when calling event handler ideAlarm
2017-09-30 16:06:47.550 Error: dzVents: Error: ideAlarm V2.0.3: ...e/pi/domoticz/scripts/dzVents/modules/ideAlarmModule.lua:423: attempt to index a nil value
I bought a RFID scanner and connected the outputs to a fibaro relais switch. I disarm with tag and can also disarm with a personal code If someone wants acces without a tag. Arming is done with a push on the bell at the panel.maskfaen wrote: ↑Saturday 30 September 2017 16:18 How do you guys implement the Security panel in a nice way?
Or should I get some kind of nice hardware to arm/disarm?
I am using ImperiHome on a wall mounted tablet at the front door - Any suggestions?
WAF and reliability is important.
I also installed ideAlarm and got this error when arming:
Thanks for what seems to be the script I will be using for my home alarm to beCode: Select all
2017-09-30 16:06:47.549 Error: dzVents: Error: ideAlarm V2.0.3: There is no device with that name or id: Security Panel 2017-09-30 16:06:47.550 Error: dzVents: Error: ideAlarm V2.0.3: An error occured when calling event handler ideAlarm 2017-09-30 16:06:47.550 Error: dzVents: Error: ideAlarm V2.0.3: ...e/pi/domoticz/scripts/dzVents/modules/ideAlarmModule.lua:423: attempt to index a nil value
Code: Select all
2017-10-01 09:24:13.324 User: Admin initiated a switch command (172/Toggle Z1 Arm Away/On)
2017-10-01 09:24:13.445 dzVents: Info: Handling events for: "Toggle Z1 Arm Away", value: "On"
2017-10-01 09:24:13.445 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Toggle Z1 Arm Away (ideAlarm)", Index: 172
2017-10-01 09:24:13.446 dzVents: Info: ideAlarm V2.0.3: triggerType toggleSwitch
2017-10-01 09:24:13.446 dzVents: Info: ideAlarm V2.0.3: Armed Away Alarm mode toggle button for zone "Hemmet" was pushed.
2017-10-01 09:24:13.449 dzVents: Info: ideAlarm V2.0.3: Hemmet new status: Arming immediately
2017-10-01 09:24:13.449 dzVents: Info: ideAlarm V2.0.3: Arming zone Hemmet to Armed Away with a delay of 20 seconds
2017-10-01 09:24:13.458 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:24:13.458 EventSystem: Fetching url...
2017-10-01 09:24:13.458 EventSystem: Script event triggered: /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua
2017-10-01 09:24:13.757 dzVents: Info: Handling events for: "Z1 Status", value: "Arming"
2017-10-01 09:24:13.757 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Z1 Status (ideAlarm)", Index: 170
2017-10-01 09:24:13.758 dzVents: Info: ideAlarm V2.0.3: triggerType status
2017-10-01 09:24:13.759 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:24:15.453 dzVents: Info: Handling events for: "Toggle Z1 Arm Away", value: "Off"
2017-10-01 09:24:15.453 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Toggle Z1 Arm Away (ideAlarm)", Index: 172
2017-10-01 09:24:15.454 dzVents: Info: ideAlarm V2.0.3: triggerType sensor
2017-10-01 09:24:15.456 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:24:33.613 dzVents: Info: Handling events for: "Z1 Arming Mode", value: "Armed Away"
2017-10-01 09:24:33.613 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Z1 Arming Mode (ideAlarm)", Index: 169
2017-10-01 09:24:33.614 dzVents: Info: ideAlarm V2.0.3: triggerType armingMode
2017-10-01 09:24:33.614 dzVents: Info: ideAlarm V2.0.3: Hemmet new status: Normal immediately
2017-10-01 09:24:33.615 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:24:33.615 EventSystem: Fetching url...
2017-10-01 09:24:33.615 EventSystem: Script event triggered: /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua
2017-10-01 09:24:33.900 dzVents: Info: Handling events for: "Z1 Status", value: "Normal"
2017-10-01 09:24:33.900 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Z1 Status (ideAlarm)", Index: 170
2017-10-01 09:24:33.900 dzVents: Info: ideAlarm V2.0.3: triggerType status
2017-10-01 09:24:33.902 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:25:05.236 dzVents: Info: Handling events for: "Rörelse Entre", value: "On"
2017-10-01 09:25:05.236 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84
2017-10-01 09:25:05.238 dzVents: Info: ideAlarm V2.0.3: triggerType sensor
2017-10-01 09:25:05.239 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:25:05.240 dzVents: Info: ------ Start internal script: Morgonljus: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84
2017-10-01 09:25:05.240 dzVents: Info: ------ Finished Morgonljus
2017-10-01 09:26:00.462 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua:, trigger: every other minute
2017-10-01 09:26:00.464 dzVents: Info: ideAlarm V2.0.3: triggerType timer
2017-10-01 09:26:00.483 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:26:06.026 dzVents: Info: Handling events for: "Rörelse Entre", value: "Off"
2017-10-01 09:26:06.026 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84
2017-10-01 09:26:06.026 dzVents: Info: ideAlarm V2.0.3: triggerType sensor
2017-10-01 09:26:06.028 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua
2017-10-01 09:26:06.028 dzVents: Info: ------ Start internal script: Morgonljus: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84
2017-10-01 09:26:06.030 dzVents: Info: ------ Finished Morgonljus
Hi. Please check the Wiki at First Installation. It seems that you have not downloaded the ideAlarm module. Please also check that all the other necessary files are in place by following the installation procedure.EdwinK wrote: ↑Friday 29 September 2017 14:46 Playing with this again
Code: Select all
017-09-29 14:41:15.200 Error: dzVents: Error: .../local/domoticz/var/scripts/dzVents/scripts/ideAlarm.lua:13: module 'ideAlarmModule' not found: no field package.preload['ideAlarmModule'] no file '/usr/local/domoticz/var/scripts/dzVents/modules/ideAlarmModule.lua' ...
Code: Select all
~/domoticz/scripts/dzVents/modules/ideAlarmModule.lua
Code: Select all
/usr/local/domoticz/scripts/dzVents/modules/ideAlarmModule.lua
Hi there @maskfaenmaskfaen wrote: ↑Saturday 30 September 2017 16:18 ......Code: Select all
2017-09-30 16:06:47.549 Error: dzVents: Error: ideAlarm V2.0.3: There is no device with that name or id: Security Panel 2017-09-30 16:06:47.550 Error: dzVents: Error: ideAlarm V2.0.3: An error occured when calling event handler ideAlarm 2017-09-30 16:06:47.550 Error: dzVents: Error: ideAlarm V2.0.3: ...e/pi/domoticz/scripts/dzVents/modules/ideAlarmModule.lua:423: attempt to index a nil value
What shall happen when a sensor is tripped is defined in your custom helper function named alarmZoneTripped. See Wiki here.maskfaen wrote: ↑Sunday 01 October 2017 0:21 ...
BUT I still do not get how this should work..
- I arm the alarm with "Toggle Z1 Arm Away"
- I get the status to "Armed away" / "Normal"
- I trigger the motion sensor
NOTHING happens.
No notification, no switch (I created a virtual switch named 'Siren'). It still just says "Armed away" / "Normal".
I most be missing something?
Your device "Rörelse Entre" is invoking the ideAlarm script indeed but no action is taken for some reason.maskfaen wrote: ↑Sunday 01 October 2017 9:31 I guess i should add my LOG.
I first trigger the Z1 Away. Then I go and set off the motionsensor after its armed.
'Hemmet' is what I renamed "My Home" to.
The motionsensor is 'Rörelse Entre'. Why does it not trigger alert/alarm?
Code: Select all
2017-10-01 09:24:13.324 User: Admin initiated a switch command (172/Toggle Z1 Arm Away/On) 2017-10-01 09:24:13.445 dzVents: Info: Handling events for: "Toggle Z1 Arm Away", value: "On" 2017-10-01 09:24:13.445 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Toggle Z1 Arm Away (ideAlarm)", Index: 172 2017-10-01 09:24:13.446 dzVents: Info: ideAlarm V2.0.3: triggerType toggleSwitch 2017-10-01 09:24:13.446 dzVents: Info: ideAlarm V2.0.3: Armed Away Alarm mode toggle button for zone "Hemmet" was pushed. 2017-10-01 09:24:13.449 dzVents: Info: ideAlarm V2.0.3: Hemmet new status: Arming immediately 2017-10-01 09:24:13.449 dzVents: Info: ideAlarm V2.0.3: Arming zone Hemmet to Armed Away with a delay of 20 seconds 2017-10-01 09:24:13.458 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:24:13.458 EventSystem: Fetching url... 2017-10-01 09:24:13.458 EventSystem: Script event triggered: /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua 2017-10-01 09:24:13.757 dzVents: Info: Handling events for: "Z1 Status", value: "Arming" 2017-10-01 09:24:13.757 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Z1 Status (ideAlarm)", Index: 170 2017-10-01 09:24:13.758 dzVents: Info: ideAlarm V2.0.3: triggerType status 2017-10-01 09:24:13.759 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:24:15.453 dzVents: Info: Handling events for: "Toggle Z1 Arm Away", value: "Off" 2017-10-01 09:24:15.453 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Toggle Z1 Arm Away (ideAlarm)", Index: 172 2017-10-01 09:24:15.454 dzVents: Info: ideAlarm V2.0.3: triggerType sensor 2017-10-01 09:24:15.456 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:24:33.613 dzVents: Info: Handling events for: "Z1 Arming Mode", value: "Armed Away" 2017-10-01 09:24:33.613 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Z1 Arming Mode (ideAlarm)", Index: 169 2017-10-01 09:24:33.614 dzVents: Info: ideAlarm V2.0.3: triggerType armingMode 2017-10-01 09:24:33.614 dzVents: Info: ideAlarm V2.0.3: Hemmet new status: Normal immediately 2017-10-01 09:24:33.615 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:24:33.615 EventSystem: Fetching url... 2017-10-01 09:24:33.615 EventSystem: Script event triggered: /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua 2017-10-01 09:24:33.900 dzVents: Info: Handling events for: "Z1 Status", value: "Normal" 2017-10-01 09:24:33.900 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Z1 Status (ideAlarm)", Index: 170 2017-10-01 09:24:33.900 dzVents: Info: ideAlarm V2.0.3: triggerType status 2017-10-01 09:24:33.902 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:25:05.236 dzVents: Info: Handling events for: "Rörelse Entre", value: "On" 2017-10-01 09:25:05.236 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84 2017-10-01 09:25:05.238 dzVents: Info: ideAlarm V2.0.3: triggerType sensor 2017-10-01 09:25:05.239 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:25:05.240 dzVents: Info: ------ Start internal script: Morgonljus: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84 2017-10-01 09:25:05.240 dzVents: Info: ------ Finished Morgonljus 2017-10-01 09:26:00.462 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua:, trigger: every other minute 2017-10-01 09:26:00.464 dzVents: Info: ideAlarm V2.0.3: triggerType timer 2017-10-01 09:26:00.483 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:26:06.026 dzVents: Info: Handling events for: "Rörelse Entre", value: "Off" 2017-10-01 09:26:06.026 dzVents: Info: ideAlarm V2.0.3: ------ Start external script: ideAlarm.lua: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84 2017-10-01 09:26:06.026 dzVents: Info: ideAlarm V2.0.3: triggerType sensor 2017-10-01 09:26:06.028 dzVents: Info: ideAlarm V2.0.3: ------ Finished ideAlarm.lua 2017-10-01 09:26:06.028 dzVents: Info: ------ Start internal script: Morgonljus: Device: "Rörelse Entre (Aeon Labs ZStick)", Index: 84 2017-10-01 09:26:06.030 dzVents: Info: ------ Finished Morgonljus
Users browsing this forum: Gingerpale and 1 guest