From 52f8e82ea16db545d85104d7e87fb872384dd778 Mon Sep 17 00:00:00 2001 From: Timothy Harder Date: Sun, 7 Jan 2024 14:02:44 -0600 Subject: [PATCH] _getAdminChannelIndex can get the index of the admin channel regardless of case. --- meshtastic/node.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/meshtastic/node.py b/meshtastic/node.py index 2b64d2c..873010f 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -266,11 +266,10 @@ class Node: def _getAdminChannelIndex(self): """Return the channel number of the admin channel, or 0 if no reserved channel""" - c = self.getChannelByName("admin") - if c: - return c.index - else: - return 0 + for c in self.channels or []: + if c.settings and c.settings.name.lower() == "admin": + return c.index + return 0 def setOwner(self, long_name=None, short_name=None, is_licensed=False): """Set device owner name"""