-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[homewizard] Add batteries channels to p1 meter #19389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Gearrel Welvaart <[email protected]>
Signed-off-by: Gearrel Welvaart <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds battery management channels to the P1 meter device to support HomeWizard Plug-In Battery control. The implementation introduces API v2 support with a bearer token for authentication and provides five new battery-related channels for monitoring and controlling battery systems.
Key Changes
- Added five new battery channels (mode, power, target_power, max_consumption, max_production) to the P1 meter
- Implemented API v2 support with bearer token authentication
- Refactored device handlers to use
handleMeasurementDataandretrieveDatanaming for clarity
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| HomeWizardP1MeterHandler.java | Added battery data retrieval and command handling for P1 meter |
| HomeWizardP1MeterBatteriesPayload.java | New DTO class for battery API response data |
| HomeWizardDeviceHandler.java | Refactored method names and added PUT request support for battery commands |
| HomeWizardBindingConstants.java | Added battery channel constants |
| hwe-p1.xml | Added battery channel group and updated thing version to 2 |
| update-hwe-p1.xml | New update instructions for adding battery channels to existing P1 meters |
| homewizard.properties | Added i18n labels for battery channels |
| README.md | Updated documentation with battery channel information |
| HomeWizardP1MeterHandlerTest.java | Added tests for battery channels with API v2 support |
| HomeWizardP1MeterBatteriesPayloadTest.java | New test class for battery payload deserialization |
| response-batteries-p1-meter.json | Test fixture with sample battery data |
| HomeWizardHandlerTest.java | Added CONFIG_V2 and battery channel helper methods |
| Various handler files | Updated method names for consistency across handlers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.../openhab/binding/homewizard/internal/devices/p1_meter/HomeWizardP1MeterBatteriesPayload.java
Outdated
Show resolved
Hide resolved
...d/src/main/java/org/openhab/binding/homewizard/internal/devices/HomeWizardDeviceHandler.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]> Signed-off-by: GearrelW <[email protected]>
…ab/binding/homewizard/internal/devices/HomeWizardDeviceHandler.java Co-authored-by: Copilot <[email protected]> Signed-off-by: GearrelW <[email protected]>
…ab/binding/homewizard/internal/devices/p1_meter/HomeWizardP1MeterBatteriesPayload.java Co-authored-by: Copilot <[email protected]> Signed-off-by: GearrelW <[email protected]>
lsiepel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked at all files, left some minor comments to look at.
.../java/org/openhab/binding/homewizard/internal/devices/p1_meter/HomeWizardP1MeterHandler.java
Outdated
Show resolved
Hide resolved
.../java/org/openhab/binding/homewizard/internal/devices/p1_meter/HomeWizardP1MeterHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.homewizard/src/main/resources/OH-INF/thing/hwe-p1.xml
Show resolved
Hide resolved
bundles/org.openhab.binding.homewizard/src/main/resources/OH-INF/thing/hwe-p1.xml
Show resolved
Hide resolved
…ab/binding/homewizard/internal/devices/p1_meter/HomeWizardP1MeterHandler.java Co-authored-by: lsiepel <[email protected]> Signed-off-by: GearrelW <[email protected]>
…ab/binding/homewizard/internal/devices/p1_meter/HomeWizardP1MeterHandler.java Co-authored-by: lsiepel <[email protected]> Signed-off-by: GearrelW <[email protected]>
Signed-off-by: Gearrel Welvaart <[email protected]>
Signed-off-by: Gearrel Welvaart <[email protected]>
lsiepel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM
Extra channels were added to the p1 meter. These channels provide extra management for the batteries. In addition, some refactoring was done to the device handlers.