Skip to content

Commit baae6cd

Browse files
authored
Merge pull request #246 from plugwise/rev_adam_anna
Revert adam_anna related
2 parents e307b30 + 06df6a5 commit baae6cd

File tree

8 files changed

+2056
-2
lines changed

8 files changed

+2056
-2
lines changed

CHANGELOG.md

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

3+
# 0.25.12: Revert remove raising of InvalidSetupError
4+
35
# v0.25.11: Improve/change contents building on v0.25.10
46
- Revert: Improve handling of xml-data missing, raise exception with warning; the reason for adding this fix is not clear. Needs further investigation.
57
- Remove raising of InvalidSetupError, no longer needed; handled in Plugwise config_flow (function added by Frenck)

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.11"
3+
__version__ = "0.25.12"
44

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

plugwise/smile.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@
3939
SmileSensors,
4040
SmileSwitches,
4141
)
42-
from .exceptions import PlugwiseError, ResponseError, UnsupportedDeviceError
42+
from .exceptions import (
43+
InvalidSetupError,
44+
PlugwiseError,
45+
ResponseError,
46+
UnsupportedDeviceError,
47+
)
4348
from .helper import SmileComm, SmileHelper, update_helper
4449

4550

@@ -351,6 +356,11 @@ async def connect(self) -> bool:
351356
for name in vendor_names:
352357
names.append(name.text)
353358

359+
vendor_models = result.findall("./module/vendor_model")
360+
models: list[str] = []
361+
for model in vendor_models:
362+
models.append(model.text)
363+
354364
dsmrmain = result.find("./module/protocols/dsmrmain")
355365
if "Plugwise" not in names and dsmrmain is None: # pragma: no cover
356366
LOGGER.error(
@@ -360,6 +370,13 @@ async def connect(self) -> bool:
360370
)
361371
raise ResponseError
362372

373+
# Check if Anna is connected to an Adam
374+
if "159.2" in models:
375+
LOGGER.error(
376+
"Your Anna is connected to an Adam, make sure to only add the Adam as integration."
377+
)
378+
raise InvalidSetupError
379+
363380
# Determine smile specifics
364381
await self._smile_detect(result, dsmrmain)
365382

tests/test_smile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5063,6 +5063,16 @@ async def test_fail_legacy_system(self):
50635063
except pw_exceptions.InvalidXMLError:
50645064
assert True
50655065

5066+
@pytest.mark.asyncio
5067+
async def test_fail_anna_connected_to_adam(self):
5068+
"""Test erroneous adam with anna system."""
5069+
self.smile_setup = "anna_connected_to_adam"
5070+
try:
5071+
_server, _smile, _client = await self.connect_wrapper()
5072+
assert False # pragma: no cover
5073+
except pw_exceptions.InvalidSetupError:
5074+
assert True
5075+
50665076
@pytest.mark.asyncio
50675077
async def test_invalid_credentials(self):
50685078
"""Test P1 with invalid credentials setup."""

userdata/anna_connected_to_adam/core.appliances.xml

Lines changed: 546 additions & 0 deletions
Large diffs are not rendered by default.

userdata/anna_connected_to_adam/core.domain_objects.xml

Lines changed: 1128 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<locations>
3+
<location id='5b13651d79c4454684fd268850b1bff8'>
4+
<name>Living room</name>
5+
<description>The room containing the (central) home thermostat.</description>
6+
<type>livingroom</type>
7+
<created_date>2021-12-18T11:59:14.377+01:00</created_date>
8+
<modified_date>2022-03-10T18:51:47.701+01:00</modified_date>
9+
<deleted_date></deleted_date>
10+
<preset>asleep</preset>
11+
<clients/>
12+
<appliances>
13+
<appliance id='1e5e55b958ac445583602f767cb45942'/>
14+
</appliances>
15+
<logs>
16+
<point_log id='0d07ba7d4e374118bf9671d8dcab4f21'>
17+
<updated_date>2022-03-10T16:00:21.263+01:00</updated_date>
18+
<type>thermostat</type>
19+
<unit>C</unit>
20+
<last_consecutive_log_date>2021-12-27T22:00:30.398+01:00</last_consecutive_log_date>
21+
<period start_date="2022-03-10T16:00:21.263+01:00" end_date="2022-03-10T16:00:21.263+01:00">
22+
<measurement log_date="2022-03-10T16:00:21.263+01:00">19.00</measurement>
23+
</period>
24+
</point_log>
25+
<point_log id='7743c4ace1284cc282a896a1bdca43f6'>
26+
<updated_date>2022-03-10T18:51:47.685+01:00</updated_date>
27+
<type>temperature</type>
28+
<unit></unit>
29+
<last_consecutive_log_date>2021-12-28T05:55:48.016+01:00</last_consecutive_log_date>
30+
<period start_date="2022-03-10T18:51:47.685+01:00" end_date="2022-03-10T18:51:47.685+01:00">
31+
<measurement log_date="2022-03-10T18:51:47.685+01:00">19.46</measurement>
32+
</period>
33+
</point_log>
34+
</logs>
35+
<actuator_functionalities>
36+
<thermostat_functionality id='9e3dcbfd026f48d88a50add3dab7713c'>
37+
<updated_date>2022-03-10T16:00:21.264+01:00</updated_date>
38+
<type>thermostat</type>
39+
<setpoint>19</setpoint>
40+
<lower_bound>4</lower_bound>
41+
<upper_bound>30</upper_bound>
42+
<resolution>0.1</resolution>
43+
<regulations><ame_regulation id='4a99fbf28ea848a0b25d34dc18e1ed20'/></regulations>
44+
</thermostat_functionality>
45+
</actuator_functionalities>
46+
</location>
47+
<location id='da7be222ab3b420c927f3e49fade0304'>
48+
<name>Home</name>
49+
<description></description>
50+
<type>building</type>
51+
<created_date>2021-12-18T11:58:59.698+01:00</created_date>
52+
<modified_date>2022-03-10T18:58:16.023+01:00</modified_date>
53+
<deleted_date></deleted_date>
54+
<preset>home</preset>
55+
<clients/>
56+
<appliances/>
57+
<logs>
58+
<point_log id='2a2f6cb60e3c4084a65ad436cd8b7905'>
59+
<updated_date>2022-03-10T18:58:14+01:00</updated_date>
60+
<type>weather_description</type>
61+
<unit></unit>
62+
<last_consecutive_log_date>2022-03-10T18:58:14+01:00</last_consecutive_log_date>
63+
<period start_date="2022-03-10T18:58:14+01:00" end_date="2022-03-10T18:58:14+01:00">
64+
<measurement log_date="2022-03-10T18:58:14+01:00">clear</measurement>
65+
</period>
66+
<weather_descriptor id='3e533c23f5d347c1adb570b6886a8355'/>
67+
</point_log>
68+
<point_log id='8281d3abb99449de80fd612f9b6c5d8d'>
69+
<updated_date>2022-03-10T18:58:14+01:00</updated_date>
70+
<type>humidity</type>
71+
<unit>RH</unit>
72+
<last_consecutive_log_date>2022-03-10T18:58:14+01:00</last_consecutive_log_date>
73+
<period start_date="2022-03-10T18:58:14+01:00" end_date="2022-03-10T18:58:14+01:00">
74+
<measurement log_date="2022-03-10T18:58:14+01:00">45.00</measurement>
75+
</period>
76+
<hygro_meter id='31e793ddeb7e4937b3bd9c7de6132ab9'/>
77+
</point_log>
78+
<point_log id='851cd3a850e746d583271c63b643d3ae'>
79+
<updated_date>2022-03-10T18:58:14+01:00</updated_date>
80+
<type>outdoor_temperature</type>
81+
<unit>C</unit>
82+
<last_consecutive_log_date>2022-03-10T18:58:14+01:00</last_consecutive_log_date>
83+
<period start_date="2022-03-10T18:58:14+01:00" end_date="2022-03-10T18:58:14+01:00">
84+
<measurement log_date="2022-03-10T18:58:14+01:00">11.44</measurement>
85+
</period>
86+
<thermo_meter id='fd37d82e84514985893fb34ee0c665df'/>
87+
</point_log>
88+
<point_log id='9bf25e1ed8644f628ad9ca64cb35226d'>
89+
<updated_date>2022-03-10T18:58:14+01:00</updated_date>
90+
<type>wind_vector</type>
91+
<unit>m_s</unit>
92+
<last_consecutive_log_date>2022-03-10T18:58:14+01:00</last_consecutive_log_date>
93+
<period start_date="2022-03-10T18:58:14+01:00" end_date="2022-03-10T18:58:14+01:00">
94+
<measurement log_date="2022-03-10T18:58:14+01:00">(0.45,123.00)</measurement>
95+
</period>
96+
<wind_vector id='23f929d7fac24edeb4202c73bba576e2'/>
97+
</point_log>
98+
<point_log id='9e6e8353f2e84617a63fd3e2a37a7ed5'>
99+
<updated_date>2022-03-10T18:58:14+01:00</updated_date>
100+
<type>solar_irradiance</type>
101+
<unit>W_m2</unit>
102+
<last_consecutive_log_date>2022-03-10T18:58:14+01:00</last_consecutive_log_date>
103+
<period start_date="2022-03-10T18:58:14+01:00" end_date="2022-03-10T18:58:14+01:00">
104+
<measurement log_date="2022-03-10T18:58:14+01:00">0.00</measurement>
105+
</period>
106+
<irradiance_meter id='86ba5de390134606ac3be5b7dd5603a3'/>
107+
</point_log>
108+
</logs>
109+
<actuator_functionalities/>
110+
</location>
111+
</locations>

0 commit comments

Comments
 (0)