I have renamed all registered devices for the PIR with the prefix "PIR_"
Code: Select all
function print_r(prefix, arr, name)
for i, v in pairs(arr) do
if (string.sub(i,1,string.len(prefix)) == prefix) then
print(name.."::"..i.." = "..v)
end
end
end
prefix = "PIR_"
print ("---------------------------")
if type(otherdevices_lastupdate)=="table" then
print_r(prefix, otherdevices_lastupdate,"otherdevices_lastupdate")
end
if type(devicechanged)=="table" then
print_r(prefix, devicechanged,"devicechanged")
end
if type(uservariables)=="table" then
print_r(prefix, uservariables, "uservariables")
end
if type(uservariables_lastupdate)=="table" then
print_r(prefix, uservariables_lastupdate, "uservariables_lastupdate" )
end
if type(otherdevices)=="table" then
print_r(prefix, otherdevices, "otherdevices")
end
if type(otherdevices_svalues)=="table" then
print_r(prefix, otherdevices_svalues, "otherdevices_svalues")
end
commandArray = {}
return commandArray
Code: Select all
2015-11-05 19:55:51.213 LUA: ---------------------------
2015-11-05 19:55:51.213 LUA: otherdevices_lastupdate::PIR_Alarm Type: 0x07 = 2015-11-05 19:54:50
2015-11-05 19:55:51.214 LUA: otherdevices_lastupdate::PIR_Alarm_Level = 2015-11-05 19:54:50
2015-11-05 19:55:51.214 LUA: otherdevices_lastupdate::PIR_Alarm_Type = 2015-11-05 19:55:51
2015-11-05 19:55:51.214 LUA: otherdevices_lastupdate::PIR_Burglar = 2015-11-05 19:54:50
2015-11-05 19:55:51.214 LUA: devicechanged::PIR_Alarm_Type = On
2015-11-05 19:55:51.215 LUA: otherdevices::PIR_Alarm Type: 0x07 = Off
2015-11-05 19:55:51.215 LUA: otherdevices::PIR_Alarm_Level = Off
2015-11-05 19:55:51.215 LUA: otherdevices::PIR_Alarm_Type = On
2015-11-05 19:55:51.216 LUA: otherdevices::PIR_Burglar = Off
2015-11-05 19:55:51.216 LUA: otherdevices_svalues::PIR_Alarm Type: 0x07 = 0
2015-11-05 19:55:51.217 LUA: otherdevices_svalues::PIR_Alarm_Level = 0
2015-11-05 19:55:51.217 LUA: otherdevices_svalues::PIR_Alarm_Type = 255
2015-11-05 19:55:51.217 LUA: otherdevices_svalues::PIR_Burglar = 0
2015-11-05 19:55:51.154 (Razberry) Lighting 2 (PIR_Alarm_Type)
2015-11-05 19:55:51.225 OpenZWave: Alarm Level: Tamper
2015-11-05 19:55:51.286 LUA: ---------------------------
2015-11-05 19:55:51.287 LUA: otherdevices_lastupdate::PIR_Alarm Type: 0x07 = 2015-11-05 19:55:51
2015-11-05 19:55:51.287 LUA: otherdevices_lastupdate::PIR_Burglar = 2015-11-05 19:54:50
2015-11-05 19:55:51.287 LUA: otherdevices_lastupdate::PIR_Alarm_Type = 2015-11-05 19:55:51
2015-11-05 19:55:51.287 LUA: otherdevices_lastupdate::PIR_Alarm_Level = 2015-11-05 19:54:50
2015-11-05 19:55:51.288 LUA: devicechanged::PIR_Alarm Type: 0x07 = On
2015-11-05 19:55:51.288 LUA: otherdevices::PIR_Alarm Type: 0x07 = On
2015-11-05 19:55:51.288 LUA: otherdevices::PIR_Burglar = Off
2015-11-05 19:55:51.289 LUA: otherdevices::PIR_Alarm_Type = On
2015-11-05 19:55:51.289 LUA: otherdevices::PIR_Alarm_Level = Off
2015-11-05 19:55:51.289 LUA: otherdevices_svalues::PIR_Alarm Type: 0x07 = 0
2015-11-05 19:55:51.290 LUA: otherdevices_svalues::PIR_Burglar = 0
2015-11-05 19:55:51.290 LUA: otherdevices_svalues::PIR_Alarm_Type = 255
2015-11-05 19:55:51.290 LUA: otherdevices_svalues::PIR_Alarm_Level = 0
2015-11-05 19:55:51.228 (Razberry) Lighting 2 (PIR_Alarm Type: 0x07)
2015-11-05 19:55:51.357 LUA: ---------------------------
2015-11-05 19:55:51.357 LUA: otherdevices_lastupdate::PIR_Alarm Type: 0x07 = 2015-11-05 19:55:51
2015-11-05 19:55:51.357 LUA: otherdevices_lastupdate::PIR_Alarm_Level = 2015-11-05 19:55:51
2015-11-05 19:55:51.358 LUA: otherdevices_lastupdate::PIR_Alarm_Type = 2015-11-05 19:55:51
2015-11-05 19:55:51.358 LUA: otherdevices_lastupdate::PIR_Burglar = 2015-11-05 19:54:50
2015-11-05 19:55:51.358 LUA: devicechanged::PIR_Alarm_Level = On
2015-11-05 19:55:51.359 LUA: otherdevices::PIR_Alarm Type: 0x07 = On
2015-11-05 19:55:51.359 LUA: otherdevices::PIR_Alarm_Level = On
2015-11-05 19:55:51.359 LUA: otherdevices::PIR_Alarm_Type = On
2015-11-05 19:55:51.360 LUA: otherdevices::PIR_Burglar = Off
2015-11-05 19:55:51.360 LUA: otherdevices_svalues::PIR_Alarm Type: 0x07 = 0
2015-11-05 19:55:51.360 LUA: otherdevices_svalues::PIR_Alarm_Level = 255
2015-11-05 19:55:51.360 LUA: otherdevices_svalues::PIR_Alarm_Type = 255
2015-11-05 19:55:51.361 LUA: otherdevices_svalues::PIR_Burglar = 0
2015-11-05 19:55:51.298 (Razberry) Lighting 2 (PIR_Alarm_Level)
2015-11-05 19:55:51.427 LUA: ---------------------------
2015-11-05 19:55:51.428 LUA: otherdevices_lastupdate::PIR_Alarm Type: 0x07 = 2015-11-05 19:55:51
2015-11-05 19:55:51.428 LUA: otherdevices_lastupdate::PIR_Alarm_Level = 2015-11-05 19:55:51
2015-11-05 19:55:51.428 LUA: otherdevices_lastupdate::PIR_Alarm_Type = 2015-11-05 19:55:51
2015-11-05 19:55:51.428 LUA: otherdevices_lastupdate::PIR_Burglar = 2015-11-05 19:55:51
2015-11-05 19:55:51.429 LUA: devicechanged::PIR_Burglar = On
2015-11-05 19:55:51.429 LUA: otherdevices::PIR_Alarm Type: 0x07 = On
2015-11-05 19:55:51.429 LUA: otherdevices::PIR_Alarm_Level = On
2015-11-05 19:55:51.429 LUA: otherdevices::PIR_Alarm_Type = On
2015-11-05 19:55:51.430 LUA: otherdevices::PIR_Burglar = On
2015-11-05 19:55:51.430 LUA: otherdevices_svalues::PIR_Alarm Type: 0x07 = 0
2015-11-05 19:55:51.431 LUA: otherdevices_svalues::PIR_Alarm_Level = 255
2015-11-05 19:55:51.431 LUA: otherdevices_svalues::PIR_Alarm_Type = 255
2015-11-05 19:55:51.431 LUA: otherdevices_svalues::PIR_Burglar = 255
2015-11-05 19:55:51.369 (Razberry) Lighting 2 (PIR_Burglar)
1. In a LUA script, what shall I look for to detect that the PIR has triggered by movement? The field "PIR_Alarm Type: 0x07" is set to on. But later PIR_Burglar is also set to on? Why? This is not burglar.
2. In a LUA script, what shall I look for to detect that the PIR has triggered by burglar?
I believe that there is a generic test, despite PIR model, to check if a PIR is triggered either by movement or by burglar? How?