Skip to content

Commit d8336a3

Browse files
authored
Merge pull request #661 from plugwise/test-elga_2
Trying solution for Core issue #132479
2 parents b42310d + 54ef0ce commit d8336a3

File tree

16 files changed

+2311
-29
lines changed

16 files changed

+2311
-29
lines changed

.github/workflows/verify.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Latest commit
55

66
env:
77
CACHE_VERSION: 11
8-
DEFAULT_PYTHON: "3.13"
8+
DEFAULT_PYTHON: "3.13.0"
99
PRE_COMMIT_HOME: ~/.cache/pre-commit
1010

1111
on:
@@ -173,7 +173,7 @@ jobs:
173173
needs: commitcheck
174174
strategy:
175175
matrix:
176-
python-version: ["3.13", "3.12"]
176+
python-version: ["3.13.0", "3.12"]
177177
steps:
178178
- name: Check out committed code
179179
uses: actions/checkout@v4
@@ -213,7 +213,7 @@ jobs:
213213
needs: prepare-test-cache
214214
strategy:
215215
matrix:
216-
python-version: ["3.13", "3.12"]
216+
python-version: ["3.13.0", "3.12"]
217217

218218
steps:
219219
- name: Check out committed code

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.6.3
4+
5+
- Implement cooling-related fixes, trying to solve HA Core issue [#132479](https://github.com/home-assistant/core/issues/132479)
6+
37
## v1.6.2
48

59
- Improve control_state processing:

fixtures/adam_heatpump_cooling/all_data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"0ca13e8176204ca7bf6f09de59f81c83": {
4444
"available": true,
4545
"binary_sensors": {
46+
"cooling_enabled": true,
4647
"cooling_state": false,
4748
"dhw_state": true,
4849
"flame_state": false,

fixtures/adam_onoff_cooling_fake_firmware/all_data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"devices": {
33
"0ca13e8176204ca7bf6f09de59f81c83": {
44
"binary_sensors": {
5+
"cooling_enabled": true,
56
"cooling_state": true,
67
"dhw_state": true,
78
"flame_state": false,

plugwise/data.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
198198
# Switching groups data
199199
self._entity_switching_group(entity, data)
200200
# Adam data
201-
self._get_adam_data(entity, data)
201+
if self.smile(ADAM):
202+
self._get_adam_data(entity, data)
202203

203204
# Thermostat data for Anna (presets, temperatures etc)
204205
if self.smile(ANNA) and entity["dev_class"] == "thermostat":
@@ -225,26 +226,26 @@ def _get_adam_data(self, entity: GwEntityData, data: GwEntityData) -> None:
225226
"""Helper-function for _get_entity_data().
226227
227228
Determine Adam heating-status for on-off heating via valves,
228-
available regulations_modes and thermostat control_states.
229+
available regulations_modes and thermostat control_states,
230+
and add missing cooling_enabled when required.
229231
"""
230-
if self.smile(ADAM):
232+
if entity["dev_class"] == "heater_central":
231233
# Indicate heating_state based on valves being open in case of city-provided heating
232-
if (
233-
entity["dev_class"] == "heater_central"
234-
and self._on_off_device
235-
and isinstance(self._heating_valves(), int)
236-
):
234+
if self._on_off_device and isinstance(self._heating_valves(), int):
237235
data["binary_sensors"]["heating_state"] = self._heating_valves() != 0
238-
239-
# Show the allowed regulation_modes and gateway_modes
240-
if entity["dev_class"] == "gateway":
241-
if self._reg_allowed_modes:
242-
data["regulation_modes"] = self._reg_allowed_modes
243-
self._count += 1
244-
if self._gw_allowed_modes:
245-
data["gateway_modes"] = self._gw_allowed_modes
246-
self._count += 1
247-
236+
# Add cooling_enabled binary_sensor
237+
if "binary_sensors" in data:
238+
if "cooling_enabled" not in data["binary_sensors"] and self._cooling_present:
239+
data["binary_sensors"]["cooling_enabled"] = self._cooling_enabled
240+
241+
# Show the allowed regulation_modes and gateway_modes
242+
if entity["dev_class"] == "gateway":
243+
if self._reg_allowed_modes:
244+
data["regulation_modes"] = self._reg_allowed_modes
245+
self._count += 1
246+
if self._gw_allowed_modes:
247+
data["gateway_modes"] = self._gw_allowed_modes
248+
self._count += 1
248249

249250
def _climate_data(
250251
self,

plugwise/helper.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,9 @@ def _update_elga_cooling(self, data: GwEntityData) -> None:
798798
# Techneco Elga has cooling-capability
799799
self._cooling_present = True
800800
data["model"] = "Generic heater/cooler"
801-
self._cooling_enabled = data["elga_status_code"] in (8, 9)
801+
# Cooling_enabled in xml does NOT show the correct status!
802+
# Setting it specifically:
803+
self._cooling_enabled = data["binary_sensors"]["cooling_enabled"] = data["elga_status_code"] in (8, 9)
802804
data["binary_sensors"]["cooling_state"] = self._cooling_active = (
803805
data["elga_status_code"] == 8
804806
)
@@ -812,11 +814,13 @@ def _update_elga_cooling(self, data: GwEntityData) -> None:
812814

813815
def _update_loria_cooling(self, data: GwEntityData) -> None:
814816
"""Loria/Thermastage: base cooling-related on cooling_state and modulation_level."""
815-
self._cooling_enabled = data["binary_sensors"]["cooling_state"]
817+
# For Loria/Thermastage it's not clear if cooling_enabled in xml shows the correct status,
818+
# setting it specifically:
819+
self._cooling_enabled = data["binary_sensors"]["cooling_enabled"] = data["binary_sensors"]["cooling_state"]
816820
self._cooling_active = data["sensors"]["modulation_level"] == 100
817821
# For Loria the above does not work (pw-beta issue #301)
818822
if "cooling_ena_switch" in data["switches"]:
819-
self._cooling_enabled = data["switches"]["cooling_ena_switch"]
823+
self._cooling_enabled = data["binary_sensors"]["cooling_enabled"] = data["switches"]["cooling_ena_switch"]
820824
self._cooling_active = data["binary_sensors"]["cooling_state"]
821825

822826
def _cleanup_data(self, data: GwEntityData) -> None:

plugwise/smile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ async def async_update(self) -> PlugwiseData:
131131
try:
132132
await self.full_xml_update()
133133
self.get_all_gateway_entities()
134+
# Set self._cooling_enabled -required for set_temperature,
135+
#also, check for a failed data-retrieval
134136
if "heater_id" in self.gw_data:
135137
heat_cooler = self.gw_entities[self.gw_data["heater_id"]]
136138
if (

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "plugwise"
7-
version = "1.6.2"
7+
version = "1.6.3"
88
license = {file = "LICENSE"}
99
description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
1010
readme = "README.md"

tests/data/adam/adam_heatpump_cooling.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"0ca13e8176204ca7bf6f09de59f81c83": {
4444
"available": true,
4545
"binary_sensors": {
46+
"cooling_enabled": true,
4647
"cooling_state": false,
4748
"dhw_state": true,
4849
"flame_state": false,

tests/data/adam/adam_onoff_cooling_fake_firmware.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"entities": {
33
"0ca13e8176204ca7bf6f09de59f81c83": {
44
"binary_sensors": {
5+
"cooling_enabled": true,
56
"cooling_state": true,
67
"dhw_state": true,
78
"flame_state": false,

0 commit comments

Comments
 (0)