Skip to content

Commit 868b95e

Browse files
committed
apc_modbus: Fix outlet group command handling to be dynamic
Replace hardcoded outlet group commands with dynamic detection and handling based on the `SOGRelayConfigSetting` register. This ensures commands and variables are only exposed for outlet groups that are actually present on the UPS. Key changes: - Add `APC_VF_UNAVAILABLE` flag to mark registers for absent outlet groups - Add outlet group info table tracking presence and target bits for each group (`MOG`, `SOG0` to `SOG2`) - Dynamically enumerate `outlet.group.N.id`, `outlet.group.N.designator` and `outlet.group.N.status` variables based on detected groups - Replace static outlet command entries with `_apc_modbus_handle_outlet_cmd()` which parses `load.*`, `shutdown.*`, and `outlet.group.N.*` commands at runtime - Global `load.*` and `shutdown.*` commands now target all available outlet groups instead of only the main outlet group (`MOG`) - Add `outlet.group.N.*` commands (`load.off`, `load.on`, `load.cycle`, etc.) for each detected group - Update `upsdrv_shutdown()` to use the unified command handler - Add `OutletStatus_BF` bitfield definitions to header This fixes issues where commands were exposed for non-existent outlet groups and ensures load/shutdown operations affect all outlets on UPS units with switched outlet groups. Signed-off-by: Axel Gembe <axel@gembe.net>
1 parent 50ec847 commit 868b95e

3 files changed

Lines changed: 386 additions & 72 deletions

File tree

NEWS.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ but the `nutshutdown` script would bail out quickly and quietly. [PR #3008]
181181
- `apc_modbus` driver updates:
182182
* Fixed register range in a logging string.
183183
* Add outlet group timers.
184+
* Fixed outlet group command handling to dynamically detect available groups
185+
(MOG, SOG0 - SOG2) in the device. Commands and variables are now only
186+
exposed for outlet groups actually present on the UPS. Global `load.*` and
187+
`shutdown.*` commands now correctly target all available outlet groups.
188+
[PR #3395]
184189

185190
- Introduced a new NUT driver named `meanwell_ntu` which provides support for
186191
the Mean Well NTU series hybrid inverter and UPS units. [PR #3206]

0 commit comments

Comments
 (0)