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

Added config file



git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2585 b32b6428-25c9-4566-ad07-03861ab6144f
parent 5f37c1ee
No related branches found
No related tags found
No related merge requests found
......@@ -51,10 +51,17 @@ class GW(object):
async def add_accessories(self,pairing):
accs = await pairing.list_accessories_and_characteristics()
tmp = []
for k in accs:
aid = k['aid']
obj = accessories.Accessory(aid,k['services'],tools.get_random_base_uuid(),self)
cfg = self.cfg.get('devices',{}).get('%s'%aid,{})
addr = None
if cfg:
uuid = cfg.get('base_addr',None)
if uuid: addr=tools.get_uuid(uuid)
if addr == None:
addr = tools.get_random_base_uuid()
self.cfg['devices'].update({'%s' % aid:{'base_addr':addr}})
obj = accessories.Accessory(aid,k['services'],addr,self)
self.accessories.append(obj)
tmp = tmp + list(obj.subscribed.keys())
await self.subscribe(pairing,tmp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment