Skip to content

feat: MQTT / Home Assistant bridge + modern packaging - #1

Merged
JarbasAl merged 0 commit into
devfrom
feat/mqtt-ha-bridge
Jun 4, 2026
Merged

feat: MQTT / Home Assistant bridge + modern packaging#1
JarbasAl merged 0 commit into
devfrom
feat/mqtt-ha-bridge

Conversation

@JarbasAl

@JarbasAl JarbasAl commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Turns PowerGuess into a Home Assistant power sensor for headless Linux devices (Raspberry Pi, mini PC, SBC, laptop) that have no smart plug, and decouples the core from OVOS.

What's new

  • python -m powerguess — publishes power/current/voltage (and battery on devices that have one) to MQTT with Home Assistant auto-discovery, mirroring the sibling vad2mqtt/shazam2mqtt bridges.
  • Env-var config, Dockerfile + docker-compose.yml, GHCR build workflow, and HA docs with a dashboard card + Energy-dashboard recipe.
  • Core (guess/utils/mqtt_client/config) no longer imports OVOS; the PHAL sensor integration moved behind the phal extra.

Modernization

  • PEP 621 pyproject (dynamic version), Apache-2.0, gh-automations reusable CI @dev.
  • Offline pytest suite (battery//sys reads mocked) — 19 tests, 68% coverage.

Bugs fixed along the way

  • from distutils.spawn import find_executableshutil.which (distutils is removed in 3.12+, so the package failed to import on the CI matrix).
  • transform_range was missing the output offset — the idle estimate returned 0 W instead of idle power.
  • No benchmark profile loaded when the device model is unidentifiable → guesstimate crashed; now falls back to a generic profile.
  • Model filename mismatches (pi3b+.json/pi2.jsonpi3bplus.json/pi2b.json).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ccd25f71-4bd7-4a62-93b1-cfd4da0962b9

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 feat/mqtt-ha-bridge

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.

@JarbasAl JarbasAl closed this Jun 4, 2026
@JarbasAl JarbasAl reopened this Jun 4, 2026
@JarbasAl
JarbasAl merged commit 98520d4 into dev Jun 4, 2026
1 check passed
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.

1 participant