Repository navigation
Make README example work on all devices and note Python 3.12 requirement - #647
Merged
Merged
Conversation
The example called telegram() (P1 Meter only) and system(power_on=True) (Energy Socket only) unconditionally, so it raised UnsupportedError on every device type. Guard both with the device's supports_*() checks. Also state the Python 3.12 requirement under Installation: on older Python versions pip silently installs 6.3.0, which does not match the example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #647 +/- ##
=======================================
Coverage 99.33% 99.33%
=======================================
Files 9 9
Lines 751 751
Branches 79 79
=======================================
Hits 746 746
Misses 2 2
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hoefnageltom
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #591
What
telegram()only works on the P1 Meter andsystem(power_on=True)only on the Energy Socket. The example called both unconditionally, so it raisedUnsupportedErroron every device type. Both calls are now guarded withdevice.supports_telegram()/device.supports_state(), with a comment explaining why.requires_python >=3.9), which has noHomeWizardEnergyV1and nomeasurement(). That is what the reporter of problems running the example script #591 ran into on Python 3.9, andpip install --upgradecannot get past it.Testing
Ran the updated example unchanged against mock v1 devices serving the fixtures from
tests/v1/fixtures, with 10.4.1 from PyPI. It now completes on HWE-P1, HWE-SKT, HWE-KWH1, HWE-KWH3, HWE-WTR, SDM230-wifi and SDM630-wifi. Only the P1 fetches the telegram, and only the Energy Socket sends the state update. Before this change it failed on the P1 (State is not supported) and the Energy Socket (Telegram is not supported). Not tested against real hardware.🤖 Generated with Claude Code