wait for x seconds
Posted: Wednesday 30 October 2019 15:41
Hi, I build a small security system with domoticz as my professional system is becoming old and partially integrated in my domoticz.
I have two doorsensors as a test and use the security panel and a remote key.
My prof alarm system also switches the security panel after some soldering, so i have a working basis!
I bought two sensors, the wifi kerui works great with open and close, the other not, this is '$doorsensor_meterkast_2.
When i
a. switch off the alarm with a remote key it takes some time before the security panel is switch off
b. When i open the door and the doorsensor gives a message, it will trigger an alarm when the secpanel is armed
Question:
1. if the panel is still busy with switching to off is it possible that my door open message still activates the alarm? or is it queued?
2. do i have to create a wait timer before check the panel status? and how?
3. The cheaper sensor '$doorsensor_meterkast_2 sends only an on message i think, i attached a dump with:
http://192.168.20.35:82/json.htm?type=d ... ayhidden=1
when i open/close the sensors i see data and status change from Action, to ALarm etc. but when i use these values as item.state it does not work
Can you look at my datadump for an explanation
PM: i use 2 extra sensors that are copies off my real sensors because dashticz interpretates these sensors wrong and diferently...
I have two doorsensors as a test and use the security panel and a remote key.
My prof alarm system also switches the security panel after some soldering, so i have a working basis!
I bought two sensors, the wifi kerui works great with open and close, the other not, this is '$doorsensor_meterkast_2.
When i
a. switch off the alarm with a remote key it takes some time before the security panel is switch off
b. When i open the door and the doorsensor gives a message, it will trigger an alarm when the secpanel is armed
Question:
1. if the panel is still busy with switching to off is it possible that my door open message still activates the alarm? or is it queued?
2. do i have to create a wait timer before check the panel status? and how?
3. The cheaper sensor '$doorsensor_meterkast_2 sends only an on message i think, i attached a dump with:
http://192.168.20.35:82/json.htm?type=d ... ayhidden=1
when i open/close the sensors i see data and status change from Action, to ALarm etc. but when i use these values as item.state it does not work
Can you look at my datadump for an explanation
PM: i use 2 extra sensors that are copies off my real sensors because dashticz interpretates these sensors wrong and diferently...
Code: Select all
--http://192.168.20.35:82/json.htm?type=devices&rid=1774&displayhidden=1
--kijk naar status en data
return {
on = {
devices = {'$doorsensor*'}
},
logging = { level = domoticz.LOG_ERROR, -- change to LOG_ERROR when script runs without problems otherwise LOG_DEBUG
},
execute = function(dz,item,info)
_G.logMarker = _G.moduleLabel -- marker wordt scriptnaam
local securityPanel = dz.devices(1728) --security panel
local messageTable = {}
if item.name == '$doorsensor_meterkast_2' then
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is:' .. item.state)
if item.state == 'Alarm' then
dz.devices('doorsensor_meterkast_2').open().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is alarm...')
elseif item.state == 'Motion' then
dz.devices('doorsensor_meterkast_2').open().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is motion...')
else
dz.devices('doorsensor_meterkast_2').close().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is:' .. item.state)
end
-- function wilcard gebruiken om alle sensoren gelijk te behandeln
elseif item.name == '$doorsensor_tuindeur_1' then
if item.state == 'Open' then
dz.devices('doorsensor_tuindeur_1').open().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. ' status: deur is open...')
if (securityPanel.state ~= 'Disarmed') then
dz.devices('Alarm_knop').switchOn().checkFirst()
end
else
dz.devices('doorsensor_tuindeur_1').close().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. ' status: deur is dicht...')
end
end
dz.helpers.globalMessage2(dz,item,info,messageTable,'chg') -- dump
end
}