From 03b3bc05f7f58b59c3f2bef2be0e4c48288ab3e1 Mon Sep 17 00:00:00 2001 From: Alexander Indenbaum Date: Tue, 5 Dec 2023 16:10:07 +0200 Subject: [PATCH] group id starts with 0 Signed-off-by: Alexander Indenbaum --- control/grpc.py | 2 +- control/server.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/control/grpc.py b/control/grpc.py index 169ea23e..20023144 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -323,7 +323,7 @@ def create_subsystem_safe(self, request, context=None): raise Exception(f"Can't create a discovery subsystem") # Assuming max of 32 gateways and protocol min 1 max 65519 - offset = (self.group_id - 1) * 2040 + offset = self.group_id * 2040 min_cntlid = offset + 1 max_cntlid = offset + 2040 if not request.serial_number: diff --git a/control/server.py b/control/server.py index 7d242d53..e84629f7 100644 --- a/control/server.py +++ b/control/server.py @@ -107,7 +107,7 @@ def __exit__(self, exc_type, exc_value, traceback): def set_group_id(self, id: int): self.logger.info(f"Gateway {self.name} group {id=}") - assert id >= 1 and id <= MAX_ANA_GROUPS + assert id >= 0 and id < MAX_ANA_GROUPS self.group_id = id self.monitor_event.set()