Skip to content

Commit ca23933

Browse files
authored
Merge pull request #235 from plugwise/core-81531
Fix for Core PR #81531
2 parents 42349e5 + 2c09ccb commit ca23933

File tree

8 files changed

+37
-15
lines changed

8 files changed

+37
-15
lines changed

CHANGELOG.md

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

3+
# v0.25.6: Revert py.typed, fix Core PR #81531
4+
5+
# v0.25.5: not released
6+
37
# v0.25.4: Add py.typed, fix typing as suggested in #231
48

59
# v0.25.3: Bugfix for https://github.com/plugwise/plugwise-beta/issues/309

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.25.4"
3+
__version__ = "0.25.6"
44

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

plugwise/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,8 @@
388388
DEFAULT_TIMEOUT: Final = 30
389389
DEFAULT_USERNAME: Final = "smile"
390390
DEFAULT_PORT: Final = 80
391+
DEFAULT_PW_MAX: Final = 30.0
392+
DEFAULT_PW_MIN: Final = 4.0
391393
NONE: Final = "None"
392394
FAKE_APPL: Final = "aaaa0000aaaa0000aaaa0000aaaa00aa"
393395
FAKE_LOC: Final = "0000aaaa0000aaaa0000aaaa0000aa00"

plugwise/helper.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
BINARY_SENSORS,
2626
DATA,
2727
DAYS,
28+
DEFAULT_PW_MAX,
29+
DEFAULT_PW_MIN,
2830
DEVICE_MEASUREMENTS,
2931
ENERGY_KILO_WATT_HOUR,
3032
ENERGY_WATT_HOUR,
@@ -794,16 +796,21 @@ def _presets(self, loc_id: str) -> dict[str, list[float]]:
794796

795797
for directive in directives:
796798
preset = directive.find("then").attrib
797-
keys, dummy = zip(*preset.items())
798-
if str(keys[0]) == "setpoint":
799-
presets[directive.attrib["preset"]] = [
800-
float(preset.get("setpoint")),
801-
0,
802-
]
799+
if "setpoint" in preset:
800+
if not self._cooling_present or self._cooling_enabled:
801+
presets[directive.attrib["preset"]] = [
802+
float(preset["setpoint"]),
803+
DEFAULT_PW_MIN,
804+
]
805+
else:
806+
presets[directive.attrib["preset"]] = [ # pragma: no cover
807+
float(preset["setpoint"]),
808+
DEFAULT_PW_MAX,
809+
]
803810
else:
804811
presets[directive.attrib["preset"]] = [
805-
float(preset.get("heating_setpoint")),
806-
float(preset.get("cooling_setpoint")),
812+
float(preset["heating_setpoint"]),
813+
float(preset["cooling_setpoint"]),
807814
]
808815

809816
return presets
@@ -1241,14 +1248,24 @@ def _schedules(
12411248
for rule_id, loc_id in rule_ids.items():
12421249
name = self._domain_objects.find(f'./rule[@id="{rule_id}"]/name').text
12431250
schedule: dict[str, list[float]] = {}
1244-
# Only process the active schedule in detail for Anna with cooling
1251+
# Only process the active schedule in detail for Adam or Anna with cooling
12451252
if self._cooling_present and loc_id != NONE:
12461253
locator = f'./rule[@id="{rule_id}"]/directives'
12471254
directives = self._domain_objects.find(locator)
12481255
for directive in directives:
12491256
entry = directive.find("then").attrib
1250-
keys, dummy = zip(*entry.items())
1251-
if str(keys[0]) == "preset":
1257+
if "setpoint" in entry:
1258+
if not self._cooling_present or self._cooling_enabled:
1259+
schedule[directive.attrib["time"]] = [
1260+
float(entry["setpoint"]),
1261+
DEFAULT_PW_MIN,
1262+
]
1263+
else:
1264+
schedule[directive.attrib["time"]] = [
1265+
float(entry["setpoint"]),
1266+
DEFAULT_PW_MAX,
1267+
]
1268+
elif "preset" in entry:
12521269
schedule[directive.attrib["time"]] = [
12531270
float(self._presets(loc_id)[entry["preset"]][0]),
12541271
float(self._presets(loc_id)[entry["preset"]][1]),

py.typed

Whitespace-only changes.

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def readme():
3535
author_email="[email protected]",
3636
license="MIT",
3737
packages=find_packages(),
38-
package_data={"plugwise": ["py.typed"]},
3938
install_requires=[
4039
"aiohttp",
4140
"async_timeout",

userdata/adam_heatpump_cooling/core.domain_objects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@
19791979
<directives>
19801980
<when time="[sa 16:30,sa 23:30)"><then preset="home"/></when>
19811981
<when time="[su 09:00,su 23:00)"><then preset="home"/></when>
1982-
<when time="[sa 23:30,su 09:00)"><then preset="asleep"/></when>
1982+
<when time="[sa 23:30,su 09:00)"><then setpoint="17.5"/></when>
19831983
<when time="[fr 23:30,sa 08:30)"><then preset="asleep"/></when>
19841984
<when time="[sa 08:30,sa 16:30)"><then preset="away"/></when>
19851985
<when time="[su 23:00,mo 08:00)"><then preset="asleep"/></when>

userdata/anna_elga_2/core.domain_objects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,7 @@
20102010
<when time="[tu 06:45,we 06:45)"><then preset="home"/></when>
20112011
<when time="[we 06:45,th 06:45)"><then preset="home"/></when>
20122012
<when time="[th 06:45,fr 06:45)"><then preset="home"/></when>
2013-
<when time="[fr 06:45,su 08:30)"><then preset="home"/></when>
2013+
<when time="[fr 06:45,su 08:30)"><then setpoint="21.5"/></when>
20142014
<when time="[su 22:45,mo 23:00)"><then preset="asleep"/></when>
20152015
<when time="[mo 23:00,th 23:00)"><then preset="asleep"/></when>
20162016
<when time="[th 23:00,fr 23:00)"><then preset="asleep"/></when>

0 commit comments

Comments
 (0)