Skip to content

Enable HomeWizard Battery group mode by default when device controls batteries#159493

Merged
joostlek merged 2 commits intohome-assistant:devfrom
DCSBL:enable-battery-mode-by-default-homewizard
Dec 23, 2025
Merged

Enable HomeWizard Battery group mode by default when device controls batteries#159493
joostlek merged 2 commits intohome-assistant:devfrom
DCSBL:enable-battery-mode-by-default-homewizard

Conversation

@DCSBL
Copy link
Copy Markdown
Contributor

@DCSBL DCSBL commented Dec 20, 2025

Proposed change

Battery group mode was always disabled by default, but with this PR we enable it by default when the P1 Meter / kWh Meter has control over batteries.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 modifies the HomeWizard integration to enable the battery group mode select entity by default when the device has control over batteries (battery_count > 0), rather than always having it disabled by default. This improves user experience by making the battery control feature more discoverable for users with battery systems.

Key changes:

  • Dynamic entity enablement based on battery_count in the device data
  • Updated tests to verify the new default behavior for devices with and without batteries
  • Added new test fixture for P1 device without batteries to test disabled-by-default scenario

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/homewizard/select.py Added logic to check battery_count and set entity_registry_enabled_default dynamically based on whether device controls batteries
tests/components/homewizard/test_select.py Removed entity_registry_enabled_by_default fixture from tests since entity is now enabled by default for devices with batteries; added new test for disabled-by-default behavior with HWE-P1-no-batteries fixture
tests/components/homewizard/fixtures/HWE-P1-no-batteries/device.json New test fixture for P1 device without batteries
tests/components/homewizard/fixtures/HWE-P1-no-batteries/data.json New test fixture with complete P1 meter data
tests/components/homewizard/fixtures/HWE-P1-no-batteries/batteries.json New test fixture with battery_count=0 to represent device without battery control
tests/components/homewizard/fixtures/HWE-P1-no-batteries/system.json New test fixture with system configuration

Comment thread homeassistant/components/homewizard/select.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@joostlek joostlek merged commit bcc5985 into home-assistant:dev Dec 23, 2025
36 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants