async def loadNode(self, nodeId: int) -> list: """Load a node""" if nodeId == self.adapter.nodeId: # Ignore ourself return [] nodes = [] nodeInfo = await self.adapter.getNodeInfo(nodeId) node = Node(nodeId, self.adapter, list(nodeInfo.commandClass)) nodes.append(node) node.addListener(self._storage) node.basicDeviceClass = nodeInfo.basicDeviceClass # node.flirs = ? node.genericDeviceClass = nodeInfo.genericDeviceClass # node.isFailed = ? node.listening = nodeInfo.listening node.specificDeviceClass = nodeInfo.specificDeviceClass self._nodes[node.nodeId] = node if node.supports(COMMAND_CLASS_MULTI_CHANNEL_V2): endpoints = await self.adapter.getMultiChannelEndPoints(nodeId) for endpoint in range(1, endpoints + 1): nodes.append(await self.loadEndPointNode(node, endpoint)) return nodes
def test_listening(node: Node): assert node.listening is False node.listening = True assert node.listening is True