-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path196. Follow intruder during alarm
77 lines (63 loc) · 1.67 KB
/
196. Follow intruder during alarm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--[[
%% properties
24 value
24 armed
430 value
430 armed
639 value
639 armed
422 value
422 armed
444 value
444 armed
210 value
210 armed
771 value
771 armed
745 value
745 armed
601 value
601 armed
%% globals
--]]
-- IDs sensor
local sensorID = {24, 430, 639, 422, 444, 210, 771, 745, 601}
local phoneID = {710, 711} -- ID der Handys
local countID = 500
-- Funktion som sender push
function sendPush(text)
if (phoneID[1] ~= nil) then
for k=1, countID do
if phoneID[k] ~= nil then
fibaro:call(phoneID[k],'sendPush', text, 'sensor')
end
end
end
end
-- Script starter her
local startSource = fibaro:getSourceTrigger();
if (startSource['type'] == 'property')
and fibaro:getGlobalValue("Innbruddsalarm") == "true"
then
local sensorID = tonumber(startSource['deviceID'])
local sensor = tonumber(fibaro:getValue(sensorID, "value"))
local armed = tonumber(fibaro:getValue(sensorID, "armed"))
if (sensor > 0 and armed > 0
and fibaro:getGlobal("Innbruddsalarm") == 'true')
then
local room = fibaro:getRoomNameByDeviceID(sensorID)
local descr = fibaro:getValue(sensorID, "userDescription")
local subject = "Rabakken5" -- passord SMS
local message = "Innbruddsalarm Rabakken 5, " ..descr.. " (" ..room.. ")."
if sensorID == 771 -- bevegelse gang
then
fibaro:debug('Sender bilde gang')
fibaro:call(477, "sendPhotoToUser", "2"); -- kamera i gang
end
fibaro:debug(message)
sendPush(message)
fibaro:call(2, "sendEmail", subject, message); -- Mail Hans Olav
fibaro:call(515, "sendEmail", subject, message); -- SMS Nokas
fibaro:call(516, "sendEmail", subject, message); -- SMS Hans Olav
end
end