Skip to content
Snippets Groups Projects
Commit 0daab103 authored by jkerdreu's avatar jkerdreu
Browse files

Only have events on state=True




git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2675 b32b6428-25c9-4566-ad07-03861ab6144f
parent d8efed9e
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,9 @@ class GW(object):
def on_alarm(self,data):
active = []
for k in data:
#print(k)
idx = str(k['index'])
al_type = k['type']
state = k['state']
......@@ -99,8 +101,14 @@ class GW(object):
self.cfg['devices'][str(idx)] = {'addr':dev.address,'type':al_type}
if dev.dev_type=='motion.basic':
dev.attributes['presence'] = state
#print("%s %s %s %s"%(dev.address,idx,al_type,state))
dev.attributes['presence'] = True
active.append(dev)
#print(active)
for dev in self.devices.values():
if dev in active:continue
if dev.dev_type=='motion.basic':
dev.attributes['presence'] = False
def _exit(self):
cfg = tools.load_cfg(PACKAGE_NAME)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment