Skip to content

Add water_heater platform to Qube heat pump#169851

Draft
MattieGit wants to merge 11 commits intohome-assistant:devfrom
MattieGit:add-qube-water-heater
Draft

Add water_heater platform to Qube heat pump#169851
MattieGit wants to merge 11 commits intohome-assistant:devfrom
MattieGit:add-qube-water-heater

Conversation

@MattieGit
Copy link
Copy Markdown
Contributor

@MattieGit MattieGit commented May 5, 2026

Proposed change

Add a water_heater entity to the hr_energy_qube integration for domestic hot water (DHW) control. This consolidates DHW temperature monitoring and control into a single entity instead of exposing DHW boost as a standalone switch.

  • Current temperature: reads the DHW sensor (Modbus input register 30)
  • Target temperature: reads and writes the user-defined DHW setpoint (Modbus holding register 173)
  • Operation modes: heat_pump (normal) and performance (DHW boost via coil register)

As discussed in #169407, DHW boost fits better as a water_heater operation mode than a standalone switch.

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

Note: This PR depends on #169407 (switch platform) which adds the coordinator.switches attribute used by the water_heater to read the DHW boost coil state.

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Add 5 switch entities for controlling the heat pump via Modbus
coil registers:

- Summer mode: toggle between heating and cooling
- DHW boost: force an immediate DHW heating cycle
- Anti-legionella cycle: manually start anti-legionella
- Heating curve: enable/disable dynamic heating curve (config)
- Heating demand: activate heating demand via Modbus

Switch state is polled alongside sensor data in the coordinator
and stored as a separate attribute. Writes use the library's
write_switch() API with error handling and coordinator refresh.
- Move TYPE_CHECKING imports to runtime in switch.py
- Parametrize turn_on/turn_off into single test
- Parametrize connection error + write failure into single test
- Revert asyncio.gather: pymodbus does not support concurrent
  reads on a single TCP connection, sequential calls are correct
- Wrap read_all_switches() in its own try/except so a switch read
  failure doesn't make sensors/binary_sensors unavailable
- Rename summer_mode_switch to summer_mode for consistency with
  binary_sensor translation key and other switch keys
Adds a water_heater entity that consolidates DHW temperature
monitoring and control into a single entity:

- Current temperature from DHW sensor (register 30)
- Target temperature with write support (register 173)
- Operation modes: heat_pump (normal) and performance (DHW boost)
- DHW boost via tapw_timeprogram_bms_forced coil register

This replaces the previously proposed DHW boost switch with a
proper water_heater entity as suggested in review.
Adds a water_heater entity that consolidates DHW temperature
monitoring and control into a single entity:

- Current temperature from DHW sensor (register 30)
- Target temperature with write support (register 173)
- Operation modes: heat_pump (normal) and performance (DHW boost)
- DHW boost via tapw_timeprogram_bms_forced coil register
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

Adds domestic hot water control to the hr_energy_qube integration by introducing a water_heater entity and the supporting switch/coordinator plumbing needed to expose DHW boost as an operation mode within Home Assistant.

Changes:

  • Add water_heater support for DHW temperature reporting, setpoint writes, and boost/normal operation modes.
  • Add switch platform support and coordinator switch-state polling used by the new DHW controls.
  • Add fixtures, platform tests, and snapshots for the new entities.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
homeassistant/components/hr_energy_qube/water_heater.py Adds the DHW water-heater entity and its control methods.
homeassistant/components/hr_energy_qube/switch.py Adds Qube switch entities backed by Modbus coil writes.
homeassistant/components/hr_energy_qube/coordinator.py Extends polling to fetch switch/coil state alongside core data.
homeassistant/components/hr_energy_qube/const.py Registers the new switch and water-heater platforms.
homeassistant/components/hr_energy_qube/strings.json Adds entity names and translated exception messages for the new platforms.
tests/components/hr_energy_qube/conftest.py Extends the mocked client with switch and setpoint behavior.
tests/components/hr_energy_qube/test_water_heater.py Adds water-heater entity, service, and availability tests.
tests/components/hr_energy_qube/test_switch.py Adds switch entity, service, and availability tests.
tests/components/hr_energy_qube/snapshots/test_water_heater.ambr Stores expected registry/state snapshots for the water-heater entity.
tests/components/hr_energy_qube/snapshots/test_switch.ambr Stores expected registry/state snapshots for the switch entities.


try:
self.switches = await self.client.read_all_switches()
except ConnectionError, TimeoutError, OSError:
Comment on lines +76 to +78
def current_operation(self) -> str:
"""Return the current operation mode."""
if self.coordinator.switches.get(DHW_BOOST_KEY):
Comment on lines +71 to +73
def target_temperature(self) -> float | None:
"""Return the target DHW temperature."""
return self.coordinator.data.setpoint_dhw
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.

Why is the switch in the water_heater platform? I think you already a dedicated PR for this and it should be treated as a dedicated PR. :)

Copy link
Copy Markdown
Contributor Author

@MattieGit MattieGit May 6, 2026

Choose a reason for hiding this comment

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

I started this PR based on the branch from the previous PR. I will wait for the other PR to be approved and will then rebase this PR so it's clean and does not contain the switch platform.

@home-assistant home-assistant Bot marked this pull request as draft May 6, 2026 13:21
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 6, 2026

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants