fix(channels): use device-reported max_channels instead of hardcoded 8

Firmware reports MAX_GROUP_CHANNELS (typically 40 for companion builds)
in the DEVICE_INFO response. Fetch it at startup and use it in all
channel iteration loops. Previously hardcoded range(8) prevented
channels 8+ from appearing and blocked adding new channels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-02 20:38:15 +01:00
parent 9b206beeac
commit d6a7354f06
3 changed files with 16 additions and 5 deletions
+3 -3
View File
@@ -284,7 +284,7 @@ def get_channels() -> Tuple[bool, List[Dict]]:
try:
dm = _get_dm()
channels = []
for idx in range(8):
for idx in range(dm._max_channels):
info = dm.get_channel_info(idx)
if info and info.get('name'):
channels.append({
@@ -302,8 +302,8 @@ def add_channel(name: str) -> Tuple[bool, str, Optional[str]]:
"""Add a new channel."""
try:
dm = _get_dm()
# Find first free slot (1-7, slot 0 is Public)
for idx in range(1, 8):
# Find first free slot (1+, slot 0 is Public)
for idx in range(1, dm._max_channels):
info = dm.get_channel_info(idx)
if not info or not info.get('name'):
result = dm.set_channel(idx, name)