From 4ca13bcede31b52c5f79b83e62fdcb05f3823860 Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Fri, 25 Oct 2024 15:48:55 +0200 Subject: [PATCH] fix setting of list item on configure When setting the whole configuration via --configure, list types like adminKey need special handling. Previously this failed as a list cannot be appended to a list. The new code adds dedicated logic to replace the repeated value when passing a list. Also, all items of that list are converted into the correct (typed) form before setting them. --- meshtastic/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 8fc8a43..7aa9f5e 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -241,6 +241,10 @@ def setPref(config, comp_name, raw_val) -> bool: # The setter didn't like our arg type guess try again as a string config_values = getattr(config_part, config_type.name) setattr(config_values, pref.name, str(val)) + elif type(val) == list: + new_vals = [meshtastic.util.fromStr(x) for x in val] + config_values = getattr(config, config_type.name) + getattr(config_values, pref.name)[:] = new_vals else: config_values = getattr(config, config_type.name) if val == 0: