Add switch platform to Qube heat pump#169407
Add switch platform to Qube heat pump#169407MattieGit wants to merge 2 commits intohome-assistant:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a switch platform to the hr_energy_qube integration and updates the coordinator data model to include both the existing QubeState data and Modbus coil switch states.
Changes:
- Introduces 5 new
switchentities backed by Modbus coil registers, including write support + error handling. - Updates the coordinator to return a combined
QubeDeviceDataobject (state + switches) and updates sensors/binary sensors to read viadata.state.*. - Adds switch-focused tests (snapshot + on/off + error handling) and extends the shared test client fixture to mock switch read/write APIs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/hr_energy_qube/const.py | Enables forwarding the new switch platform. |
| homeassistant/components/hr_energy_qube/models.py | Adds QubeDeviceData to combine state + switch data. |
| homeassistant/components/hr_energy_qube/coordinator.py | Fetches both get_all_data() and read_all_switches() per update. |
| homeassistant/components/hr_energy_qube/sensor.py | Updates sensor value functions to read from QubeDeviceData.state. |
| homeassistant/components/hr_energy_qube/binary_sensor.py | Updates binary sensor value functions to read from QubeDeviceData.state. |
| homeassistant/components/hr_energy_qube/switch.py | New switch platform + entities, including write and refresh behavior. |
| homeassistant/components/hr_energy_qube/strings.json | Adds exception translation and switch entity names. |
| tests/components/hr_energy_qube/conftest.py | Extends mocked client to support read_all_switches() and write_switch(). |
| tests/components/hr_energy_qube/test_switch.py | Adds switch entity snapshots and functional tests for on/off + error cases. |
| tests/components/hr_energy_qube/snapshots/test_switch.ambr | Snapshot coverage for the new switch entities. |
1e032c6 to
0dcb411
Compare
| "dhw_boost": { | ||
| "name": "DHW boost" | ||
| }, | ||
| "heating_curve": { | ||
| "name": "Heating curve" | ||
| }, | ||
| "heating_demand": { | ||
| "name": "Heating demand" | ||
| }, | ||
| "summer_mode_switch": { | ||
| "name": "Summer mode" | ||
| } |
There was a problem hiding this comment.
- DHW Boost, is that separate from a water_heater preset mode?
- Summer mode, is that comparable to a holiday mode where the device goes into low energy mode and what not?
There was a problem hiding this comment.
DHW Boost forces an immediate DHW heating cycle regardless of the schedule. This is helpful when you have surplus energy available and want to use that for DHW heating.
Summer mode: It toggles the heat pump between heating and cooling mode. It's not a "holiday/low energy" mode. It's switching the operational mode from central heating to active cooling. Later on this could be part of a climate entity, but that's not implemented yet (up for the next PR).
There was a problem hiding this comment.
Is DHW boost something that we should make a preset mode or main mode? https://developers.home-assistant.io/docs/core/entity/water-heater#states
It might fit PERFORMANCE or HIGH_DEMAND
There was a problem hiding this comment.
Yes, I like that idea. Would that mean the integration will eventually have a combined water heater entity and a climate entity?
There was a problem hiding this comment.
I mean, a climate entity is supposed to heat your house, while water_heater is for DHW
There was a problem hiding this comment.
Yes, I understand. I was asking, because every owner of the Qube system will have both a heat pump and water heater in an integrated system. They might use HA to actually control heating and DHW, but it's also possible they only want to see the status and let the included thermostat take care of managing climate and DHW.
There was a problem hiding this comment.
@joostlek How about the following approach?
I'll add a water_heater entity in a follow-up PR that consolidates DHW temperature, setpoint, and boost into a single entity (with DHW boost as a preset mode). For users who only want to monitor, the entity will still show current temperature and operation state without requiring them to actively control it. For now I'll keep the DHW boost switch in this PR as a stepping stone.
There was a problem hiding this comment.
Yes but they'd view that status via the water_heater entity. As in it'd change from "the heatpump has boost mode turned on" to "the heatpump is in the boost mode state/preset", and the latter might be easier to grasp
There was a problem hiding this comment.
Yes, makes sense! I'll remove that switch from this PR and will create a new PR with the water heater entity and the preset mode.
erwindouna
left a comment
There was a problem hiding this comment.
The PR template is tempered with. Please restore it.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Please include this in the PR template. |
joostlek
left a comment
There was a problem hiding this comment.
Please leave the new platform for a later PR
Yes, accidentally added the platform to this PR. Reverted and created a new PR for the water heater platform. |
Add 4 switch entities for controlling the heat pump via Modbus coil registers: - Summer mode: toggle between heating and cooling - 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. Switch read failures are handled independently so sensors remain available. Writes use the library's write_switch() API with error handling, optimistic state update, and coordinator refresh.
2d71cce to
640b68b
Compare
Proposed change
Add a switch platform to the
hr_energy_qubeintegration with 4 switch entities for controlling the heat pump via Modbus coil registers: summer mode, anti-legionella cycle, heating curve, and heating demand. DHW boost is handled by a separate water_heater entity in #169851.Type of change
Additional information
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: