Skip to content

feat(pumps): expose VSP power and pump diagnostics#147

Open
tonyfruzza wants to merge 6 commits into
cryptk:mainfrom
tonyfruzza:feat/pump-power-diagnostics
Open

feat(pumps): expose VSP power and pump diagnostics#147
tonyfruzza wants to merge 6 commits into
cryptk:mainfrom
tonyfruzza:feat/pump-power-diagnostics

Conversation

@tonyfruzza
Copy link
Copy Markdown

Summary

Implements issue #99 by adding pump-focused diagnostics support and exposing power usage for VSP feature pumps.

Closes #99

What changed

  • Added power parsing to TelemetryPump (@power) with default 0
  • Added Pump.power property so power is available when using the library directly
  • Added OmniLogicAPI.async_get_pump_diagnostics() as a discoverable alias for pump diagnostics
  • Added CLI command: omnilogic debug get-pump-diagnostics <bow_id> <equip_id>
  • Improved parsed diagnostics output for both:
    • debug get-filter-diagnostics
    • debug get-pump-diagnostics

When not using --raw, diagnostics now prints:

  • Power: <watts> W
  • Drive Rev: <revision>
  • Display Rev: <revision>
  • Error: No errors detected (or status code)

Why this solves #99

Feature pumps that are VSPs can now be read similarly to filters:

  • power usage is exposed through Pump.power
  • diagnostics are available via pump-specific API + CLI paths

This enables flows like Node-RED / dashboards to show values similar to the OmniLogic app (e.g. 541 W).

Testing

Added tests in tests/test_api.py for:

  • pump diagnostics request XML generation
  • diagnostics decoding (541 W, Display Rev 10.1.7, Drive Rev 1.0A, no-error summary)
  • telemetry pump power parsing

I could not run pytest in this environment because pytest is not installed on this host.

@tonyfruzza
Copy link
Copy Markdown
Author

tonyfruzza commented May 19, 2026

Real-world validation note from a live OmniLogic system (firmware 5.1.85):

  • Pool filter pump (BOW=1, system_id=3) running at 70% reports
  • App diagnostics shows matching-style values: Drive Rev , Display Rev , Error

Additional observation: the current diagnostics request () returned a different computed power from on this system (1345W), while telemetry power was 541W. So telemetry appears to align better with the UI power number for this equipment.

@tonyfruzza
Copy link
Copy Markdown
Author

Follow-up with clean real-world validation data from a live OmniLogic system (firmware 5.1.85):

  • Pool filter pump: BOW=1, system_id=3
  • Pump speed: 70%
  • Telemetry reading from get filters: power = 541 W
  • App diagnostics style values observed: Drive Rev 1.0A, Display Rev 10.1.7, Error No Errors detected

Additional observation: On this system, power derived from diagnostics bytes (PowerMSB/PowerLSB from GetUIFilterDiagnosticInfo) did not match telemetry power (diagnostics computed to 1345 W while telemetry showed 541 W).

So telemetry power appears to align better with the UI power value for this equipment.

@tonyfruzza
Copy link
Copy Markdown
Author

Added follow-up refactor commit 8bc1e91 to reduce duplication while preserving the pump-power feature:\n\n- Consolidated repeated diagnostics CLI output into a shared helper\n- Removed duplicated overload boilerplate on pump diagnostics wrapper\n- Parameterized near-identical diagnostics XML tests\n\nThis was done specifically to address Sonar duplication on new code. If Sonar does not auto-run, please re-run analysis on the updated head.

Comment thread pyomnilogic_local/api/api.py Outdated
return resp
return FilterDiagnostics.load_xml(resp)

async def async_get_pump_diagnostics(self, pool_id: int, equipment_id: int, raw: bool = False) -> FilterDiagnostics | str:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all this method does is call the async_get_filter_diagnostics method, then lets not add it, and instead just use the async_get_filter_diagnostics method directly.

Comment thread pyomnilogic_local/cli/debug/commands.py Outdated
@click.argument("bow_id", type=int)
@click.argument("equip_id", type=int)
@click.pass_context
def get_pump_diagnostics(ctx: click.Context, bow_id: int, equip_id: int) -> None:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same feedback here, seems like we could just rename the get_filter_diagnostics click command to get_filter_pump_diagnostics. The debug CLI has no guarantee of stability, so we can just rename it.

- Parse pump power from telemetry (@power) and expose Pump.power
- Add async_get_pump_diagnostics API alias for VSP feature pumps
- Add debug get-pump-diagnostics CLI command
- Decode diagnostics power/revision/error into human-readable fields
- Add tests for pump diagnostics request and power parsing

Closes cryptk#99
- Remove async_get_pump_diagnostics() alias per reviewer feedback:
  just use async_get_filter_diagnostics() directly since it works
  for both filters and pumps
- Rename CLI command from get-filter-diagnostics to
  get-filter-pump-diagnostics (debug CLI has no stability guarantee)
- Remove separate get-pump-diagnostics CLI command
- Simplify test to directly test async_get_filter_diagnostics
- Update README to reflect single unified command
@tonyfruzza tonyfruzza force-pushed the feat/pump-power-diagnostics branch from ede0559 to 255f5d4 Compare May 29, 2026 15:43
The test was converted from a parametrized test but still referenced
the old 'equipment_id' parameter variable. Replace with the literal
value '2' that matches the test's direct call.
@cryptk
Copy link
Copy Markdown
Owner

cryptk commented May 29, 2026

Just as a heads up, I'll be out of the country for the next ~2 weeks, so a review on this and your other PR will have to wait until I'm back.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pumps can be VSPs as well as features

2 participants