Skip to content

Commit ae3ef99

Browse files
authored
Merge pull request #210 from plugwise/revert_heat_cool
Revert all hvac_mode HEAT_COOL related
2 parents 5d692d2 + ea03daa commit ae3ef99

File tree

9 files changed

+24
-88
lines changed

9 files changed

+24
-88
lines changed

.github/workflows/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name: Latest commit
55

66
env:
7-
CACHE_VERSION: 2
7+
CACHE_VERSION: 3
88
DEFAULT_PYTHON: "3.9"
99
PRE_COMMIT_HOME: ~/.cache/pre-commit
1010

CHANGELOG.md

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

3+
# v0.21.3: Revert all hvac_mode HEAT_COOL related
4+
- The Anna-Elga usecase, providing a heating and a cooling setpoint, was reverted back to providing a single setpoint.
5+
36
# v0.21.2: Code improvements, cleanup
47

58
# v0.21.1: Smile: various updates % fixes

plugwise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Plugwise module."""
22

3-
__version__ = "0.21.2"
3+
__version__ = "0.21.3"
44

55
from plugwise.smile import Smile
66
from plugwise.stick import Stick

plugwise/constants.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,6 @@
396396
"upper_bound",
397397
"resolution",
398398
)
399-
MAX_SETPOINT: Final[float] = 40.0
400-
MIN_SETPOINT: Final[float] = 0.0
401399
SPECIAL_FORMAT: Final[tuple[str, ...]] = (ENERGY_KILO_WATT_HOUR, VOLUME_CUBIC_METERS)
402400
SWITCH_GROUP_TYPES: Final[tuple[str, ...]] = ("switching", "report")
403401
ZONE_THERMOSTATS: Final[tuple[str, ...]] = (
@@ -560,8 +558,6 @@
560558
"outdoor_temperature",
561559
"return_temperature",
562560
"setpoint",
563-
"setpoint_high",
564-
"setpoint_low",
565561
"temperature_difference",
566562
"valve_position",
567563
"water_pressure",
@@ -661,8 +657,6 @@ class SmileSensors(TypedDict, total=False):
661657
outdoor_temperature: float
662658
return_temperature: float
663659
setpoint: float
664-
setpoint_high: float
665-
setpoint_low: float
666660
temperature_difference: float
667661
valve_position: float
668662
water_pressure: float
@@ -691,8 +685,6 @@ class ActuatorData(TypedDict, total=False):
691685

692686
lower_bound: float
693687
setpoint: float
694-
setpoint_high: float
695-
setpoint_low: float
696688
resolution: float
697689
upper_bound: float
698690

plugwise/smile.py

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
DOMAIN_OBJECTS,
2121
LOCATIONS,
2222
LOGGER,
23-
MAX_SETPOINT,
24-
MIN_SETPOINT,
2523
MODULES,
2624
NOTIFICATIONS,
2725
RULES,
@@ -30,7 +28,6 @@
3028
SWITCH_GROUP_TYPES,
3129
SYSTEM,
3230
ZONE_THERMOSTATS,
33-
ActuatorData,
3431
ApplianceData,
3532
DeviceData,
3633
GatewayData,
@@ -60,37 +57,6 @@ def update_for_cooling(self, devices: dict[str, DeviceData]) -> None:
6057
if self._elga_cooling_active or self._lortherm_cooling_active:
6158
device["binary_sensors"]["cooling_state"] = True
6259

63-
# Add setpoint_low and setpoint_high when cooling is enabled
64-
if device["dev_class"] not in ZONE_THERMOSTATS:
65-
continue
66-
67-
if self._elga_cooling_enabled:
68-
# Replace setpoint with setpoint_high/_low
69-
thermostat = device["thermostat"]
70-
sensors = device["sensors"]
71-
max_setpoint = MAX_SETPOINT
72-
min_setpoint = MIN_SETPOINT
73-
if self._sched_setpoints is not None:
74-
max_setpoint = self._sched_setpoints[1]
75-
min_setpoint = self._sched_setpoints[0]
76-
77-
temp_dict: ActuatorData = {
78-
"setpoint_low": thermostat["setpoint"],
79-
"setpoint_high": max_setpoint,
80-
}
81-
if self._elga_cooling_active:
82-
temp_dict = {
83-
"setpoint_low": min_setpoint,
84-
"setpoint_high": thermostat["setpoint"],
85-
}
86-
if "setpoint" in sensors:
87-
sensors.pop("setpoint")
88-
sensors["setpoint_low"] = temp_dict["setpoint_low"]
89-
sensors["setpoint_high"] = temp_dict["setpoint_high"]
90-
thermostat.pop("setpoint")
91-
temp_dict.update(thermostat)
92-
device["thermostat"] = temp_dict
93-
9460
# For Adam + on/off cooling, modify heating_state and cooling_state
9561
# based on provided info by Plugwise
9662
if (
@@ -656,28 +622,11 @@ async def set_preset(self, loc_id: str, preset: str) -> None:
656622

657623
await self._request(uri, method="put", data=data)
658624

659-
async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
625+
async def set_temperature(self, loc_id: str, temperature: float) -> None:
660626
"""Set the given Temperature on the relevant Thermostat."""
661-
setpoint: float | None = None
662-
if "setpoint" in items:
663-
setpoint = items["setpoint"]
664-
if self._elga_cooling_enabled:
665-
if "setpoint_low" in items:
666-
setpoint = items["setpoint_low"]
667-
if self._elga_cooling_active:
668-
if "setpoint_high" in items:
669-
setpoint = items["setpoint_high"]
670-
671-
if setpoint is None:
672-
raise PlugwiseError(
673-
"Plugwise: failed setting temperature: no valid input provided"
674-
) # pragma: no cover
675-
temperature = str(setpoint)
627+
temp = str(temperature)
676628
uri = self._thermostat_uri(loc_id)
677-
data = (
678-
"<thermostat_functionality><setpoint>"
679-
f"{temperature}</setpoint></thermostat_functionality>"
680-
)
629+
data = f"<thermostat_functionality><setpoint>{temp}</setpoint></thermostat_functionality>"
681630

682631
await self._request(uri, method="put", data=data)
683632

tests/test_smile.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,7 @@ async def tinker_switch(
484484
async def tinker_thermostat_temp(self, smile, loc_id, unhappy=False):
485485
"""Toggle temperature to test functionality."""
486486
_LOGGER.info("Asserting modifying settings in location (%s):", loc_id)
487-
test_temp = {"setpoint": 22.9}
488-
if smile._anna_cooling_present:
489-
test_temp = {"setpoint_low": 19.5, "setpoint_high": 23.5}
487+
test_temp = 22.9
490488
_LOGGER.info("- Adjusting temperature to %s", test_temp)
491489
try:
492490
await smile.set_temperature(loc_id, test_temp)
@@ -3150,8 +3148,7 @@ async def test_connect_anna_heatpump_heating(self):
31503148
"name": "Anna",
31513149
"vendor": "Plugwise",
31523150
"thermostat": {
3153-
"setpoint_low": 21.0,
3154-
"setpoint_high": 24.0,
3151+
"setpoint": 20.5,
31553152
"lower_bound": 4.0,
31563153
"upper_bound": 30.0,
31573154
"resolution": 0.1,
@@ -3164,11 +3161,10 @@ async def test_connect_anna_heatpump_heating(self):
31643161
"mode": "auto",
31653162
"sensors": {
31663163
"temperature": 19.3,
3164+
"setpoint": 20.5,
31673165
"illuminance": 86.0,
31683166
"cooling_activation_outdoor_temperature": 21.0,
31693167
"cooling_deactivation_threshold": 4.0,
3170-
"setpoint_low": 21.0,
3171-
"setpoint_high": 24.0,
31723168
},
31733169
},
31743170
}
@@ -3186,7 +3182,7 @@ async def test_connect_anna_heatpump_heating(self):
31863182
assert not smile._smile_legacy
31873183

31883184
await self.device_test(smile, testdata)
3189-
assert self.device_items == 57
3185+
assert self.device_items == 55
31903186
assert self.cooling_present
31913187
assert not self.notifications
31923188

@@ -3221,19 +3217,17 @@ async def test_connect_anna_heatpump_cooling(self):
32213217
"active_preset": "home",
32223218
"mode": "heat_cool",
32233219
"thermostat": {
3224-
"setpoint_low": 0.0,
3225-
"setpoint_high": 22.0,
3220+
"setpoint": 22.0,
32263221
"lower_bound": 4.0,
32273222
"upper_bound": 30.0,
32283223
"resolution": 0.1,
32293224
},
32303225
"sensors": {
32313226
"temperature": 22.3,
3227+
"setpoint": 22.0,
32323228
"illuminance": 25.5,
32333229
"cooling_activation_outdoor_temperature": 21.0,
32343230
"cooling_deactivation_threshold": 6.0,
3235-
"setpoint_low": 0.0,
3236-
"setpoint_high": 22.0,
32373231
},
32383232
},
32393233
# Heater central
@@ -3269,7 +3263,7 @@ async def test_connect_anna_heatpump_cooling(self):
32693263
assert not smile._smile_legacy
32703264

32713265
await self.device_test(smile, testdata)
3272-
assert self.device_items == 57
3266+
assert self.device_items == 55
32733267
assert self.cooling_present
32743268
assert not self.notifications
32753269

@@ -3575,8 +3569,7 @@ async def test_connect_anna_elga_2_cooling(self):
35753569
"name": "Anna",
35763570
"vendor": "Plugwise",
35773571
"thermostat": {
3578-
"setpoint_low": 19.0,
3579-
"setpoint_high": 23.0,
3572+
"setpoint": 23.0,
35803573
"lower_bound": 4.0,
35813574
"upper_bound": 30.0,
35823575
"resolution": 0.1,
@@ -3589,11 +3582,10 @@ async def test_connect_anna_elga_2_cooling(self):
35893582
"mode": "auto",
35903583
"sensors": {
35913584
"temperature": 24.9,
3585+
"setpoint": 23.0,
35923586
"illuminance": 0.5,
35933587
"cooling_activation_outdoor_temperature": 26.0,
35943588
"cooling_deactivation_threshold": 3.0,
3595-
"setpoint_low": 19.0,
3596-
"setpoint_high": 23.0,
35973589
},
35983590
},
35993591
"573c152e7d4f4720878222bd75638f5b": {
@@ -3654,7 +3646,7 @@ async def test_connect_anna_elga_2_cooling(self):
36543646
assert not smile._smile_legacy
36553647

36563648
await self.device_test(smile, testdata)
3657-
assert self.device_items == 57
3649+
assert self.device_items == 55
36583650
assert self.cooling_present
36593651
assert not self.notifications
36603652

userdata/anna_heatpump_cooling/core.appliances.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@
12051205
<unit>C</unit>
12061206
<last_consecutive_log_date>2020-04-16T12:22:21.258+02:00</last_consecutive_log_date>
12071207
<period start_date="2020-04-16T12:22:21.258+02:00" end_date="2020-04-16T12:22:21.258+02:00">
1208-
<measurement log_date="2020-04-16T12:22:21.258+02:00">20.00</measurement>
1208+
<measurement log_date="2020-04-16T12:22:21.258+02:00">22.00</measurement>
12091209
</period>
12101210
<thermostat id='c796d632de2e452e80eebb079067b60a'/>
12111211
</point_log>

userdata/anna_heatpump_heating/core.appliances.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@
12391239
<thermostat_functionality id='8fc0a6e427eb4274b90f5c66ce75d161'>
12401240
<updated_date>2020-04-08T22:20:25.800+02:00</updated_date>
12411241
<type>thermostat</type>
1242-
<setpoint>21</setpoint>
1242+
<setpoint>20.5</setpoint>
12431243
<lower_bound>4</lower_bound>
12441244
<upper_bound>30</upper_bound>
12451245
<resolution>0.1</resolution>

userdata/anna_heatpump_heating/core.domain_objects.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@
11601160
<unit>C</unit>
11611161
<last_consecutive_log_date>2020-04-08T10:27:27.777+02:00</last_consecutive_log_date>
11621162
<period start_date="2020-04-08T22:20:25.799+02:00" end_date="2020-04-08T22:20:25.799+02:00">
1163-
<measurement log_date="2020-04-08T22:20:25.799+02:00">21.00</measurement>
1163+
<measurement log_date="2020-04-08T22:20:25.799+02:00">20.50</measurement>
11641164
</period>
11651165
</point_log>
11661166
</logs>
@@ -1177,7 +1177,7 @@
11771177
<thermostat_functionality id='dbe0ce59091f4753a0a31b81c1e8cb2b'>
11781178
<updated_date>2020-04-08T22:20:25.800+02:00</updated_date>
11791179
<type>thermostat</type>
1180-
<setpoint>21</setpoint>
1180+
<setpoint>20.5</setpoint>
11811181
<lower_bound>4</lower_bound>
11821182
<upper_bound>30</upper_bound>
11831183
<resolution>0.1</resolution>
@@ -1533,7 +1533,7 @@
15331533
<unit>C</unit>
15341534
<last_consecutive_log_date>2020-04-08T22:20:25.799+02:00</last_consecutive_log_date>
15351535
<period start_date="2020-04-08T22:20:25.799+02:00" end_date="2020-04-08T22:20:25.799+02:00">
1536-
<measurement log_date="2020-04-08T22:20:25.799+02:00">21.00</measurement>
1536+
<measurement log_date="2020-04-08T22:20:25.799+02:00">20.50</measurement>
15371537
</period>
15381538
<thermostat id='c796d632de2e452e80eebb079067b60a'/>
15391539
</point_log>
@@ -1567,7 +1567,7 @@
15671567
<thermostat_functionality id='8fc0a6e427eb4274b90f5c66ce75d161'>
15681568
<updated_date>2020-04-08T22:20:25.800+02:00</updated_date>
15691569
<type>thermostat</type>
1570-
<setpoint>21</setpoint>
1570+
<setpoint>20.5</setpoint>
15711571
<lower_bound>4</lower_bound>
15721572
<upper_bound>30</upper_bound>
15731573
<resolution>0.1</resolution>

0 commit comments

Comments
 (0)