예제 #1
0
 def _discover(self):
     """
     Example
     Do discovery here. Does not have to be called discovery. Called from example
     controller start method and from DISCOVER command recieved from ISY as an exmaple.
     """
     if not self.authorized('discover'): return False
     self.set_auth(True)
     self.save_params()
     mgd = self.get_tag_managers()
     if not 'macs' in self.polyConfig['customData']:
         self.polyConfig['customData']['macs'] = dict()
     if mgd['st']:
         for mgr in mgd['result']:
             self.l_debug("discover", "TagManager={0}".format(mgr))
             address = mgr['mac'].lower()
             node = self.get_node(address)
             if node is None:
                 self.addNode(
                     wTagManager(self,
                                 address,
                                 mgr['name'],
                                 mgr['mac'],
                                 do_discover=True))
             else:
                 self.l_info('discover',
                             'Running discover on {0}'.format(node))
                 node.discover(thread=False)
예제 #2
0
 def add_existing_tag_managers(self):
     """
     Called on startup to add the tags from the config
     We can't rely on discover at startup in case the server is down, we need to add the ones we know about.
     """
     for address in self.controller._nodes:
         node = self.controller._nodes[address]
         if nodedef in node:
             if node[nodedef] == 'wTagManager':
                 self.l_info('add_existing_tag_managers','node={0} update={1}'.format(node,self.update_profile))
                 self.addNode(wTagManager(self, address, node['name'], address.upper(), node_data=node),update=self.update_profile)
         else:
             self.l_error('add_existing_tag_managers','node has no {0}? node={1}'.format(nodedef,node))