From 3612a54543773fbbcfcb3a6f4689a14a4aad33d5 Mon Sep 17 00:00:00 2001 From: Karstein Phobic Nyvold Kvistad Date: Fri, 24 Jul 2026 08:07:47 +0200 Subject: [PATCH] fix(device_parameters): walk connector host_parameters so host-side params are reachable list_device_parameters and set_device_parameter only iterated device.device_parameters and connector.parameters. Host-side parameter sets -- e.g. the WAGO 750-series 'K-BUS Parameters' grid (program start interlock, k-bus cycle time, TCM control) -- are exposed exclusively via ScriptConnector.host_parameters (SP21 stub ScriptDeviceParameters.pyi; helpme-codesys ScriptEngine, ScriptConnector.host_parameters), so both tools reported zero parameters on the Kbus master node. Verified on the Sea Leopard PFC200 project: id 150 'program start interlock' now lists and sets offline. --- src/scripts/list_device_parameters.py | 8 ++++++++ src/scripts/set_device_parameter.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/scripts/list_device_parameters.py b/src/scripts/list_device_parameters.py index 21b547a..5a4894b 100644 --- a/src/scripts/list_device_parameters.py +++ b/src/scripts/list_device_parameters.py @@ -45,6 +45,14 @@ try: count += 1 except Exception as e: print("DEBUG: parameter walk failed for %s: %s" % (scope, e)) + # ScriptConnector exposes the host-side parameter set (e.g. the WAGO + # "K-BUS Parameters" grid) only via host_parameters, not parameters. + try: + for param in (getattr(conn, 'host_parameters', None) or []): + print(_param_row(scope + ':host', param)) + count += 1 + except Exception as e: + print("DEBUG: host_parameter walk failed for %s: %s" % (scope, e)) print("### PARAMS_END ###") print("Device: %s" % dev_name) diff --git a/src/scripts/set_device_parameter.py b/src/scripts/set_device_parameter.py index 313d72a..c67c35d 100644 --- a/src/scripts/set_device_parameter.py +++ b/src/scripts/set_device_parameter.py @@ -40,6 +40,13 @@ def _iter_params(device): yield scope, param except Exception as e: print("DEBUG: parameter walk failed for %s: %s" % (scope, e)) + # ScriptConnector exposes the host-side parameter set (e.g. the WAGO + # "K-BUS Parameters" grid) only via host_parameters, not parameters. + try: + for param in (getattr(conn, 'host_parameters', None) or []): + yield scope + ':host', param + except Exception as e: + print("DEBUG: host_parameter walk failed for %s: %s" % (scope, e)) try: print("DEBUG: set_device_parameter script: Device='%s', Name='%s', Id='%s', GetOnly=%s, Project='%s'" % (