Add water_heater platform to Qube heat pump#169851
Add water_heater platform to Qube heat pump#169851MattieGit wants to merge 11 commits intohome-assistant:devfrom
Conversation
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.
This reverts commit c339c1b.
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
There was a problem hiding this comment.
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_heatersupport 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: |
| def current_operation(self) -> str: | ||
| """Return the current operation mode.""" | ||
| if self.coordinator.switches.get(DHW_BOOST_KEY): |
| def target_temperature(self) -> float | None: | ||
| """Return the target DHW temperature.""" | ||
| return self.coordinator.data.setpoint_dhw |
There was a problem hiding this comment.
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. :)
There was a problem hiding this comment.
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.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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.
As discussed in #169407, DHW boost fits better as a water_heater operation mode than a standalone switch.
Type of change
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
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: