Skip to content

Fix swapped voltage/current in dutlink power readings#532

Merged
mangelajo merged 1 commit into
mainfrom
fix/dutlink-power-reading-units
Apr 9, 2026
Merged

Fix swapped voltage/current in dutlink power readings#532
mangelajo merged 1 commit into
mainfrom
fix/dutlink-power-reading-units

Conversation

@ambient-code

@ambient-code ambient-code Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix bug where dutlink power readings had voltage and current values swapped
  • The device returns readings as {current}A {voltage}V {power}W but the code was using positional destructuring [v, a, _], assigning current to voltage and vice versa
  • Changed to suffix-based parsing (checking for V, A suffixes) for correctness and robustness against potential ordering changes

Fixes #67

Test plan

  • Linting passes (make lint-fix)
  • Power driver unit tests pass (make pkg-test-jumpstarter-driver-power)
  • Dutlink driver tests pass/skip as expected (make pkg-test-jumpstarter-driver-dutlink - skips due to no hardware)
  • Manual verification with dutlink hardware: client.power.read() should now report correct voltage (~11.99V) and current (~0.98A) matching the device's meter read output

🤖 Generated with Claude Code

The dutlink device returns meter readings as "{current}A {voltage}V {power}W"
but the code was parsing positionally with [v, a, _], assigning current to
voltage and vice versa. Parse by unit suffix instead for correctness and
robustness.

Fixes #67

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented Apr 9, 2026

Copy link
Copy Markdown

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit df4345a
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/69d7a018d33bb000073c69e7
😎 Deploy Preview https://deploy-preview-532--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 43d3fa80-8dcd-46a9-99f4-d207417462ea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dutlink-power-reading-units

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mangelajo mangelajo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mangelajo mangelajo merged commit 8896671 into main Apr 9, 2026
27 checks passed
@raballew raballew deleted the fix/dutlink-power-reading-units branch June 5, 2026 11:37
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.

Power reading in dutlink provides Watts as Volts m

1 participant