plugwise 1.7.3a1__py3-none-any.whl → 1.7.3a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plugwise/common.py +3 -0
- plugwise/helper.py +1 -1
- plugwise/util.py +21 -30
- {plugwise-1.7.3a1.dist-info → plugwise-1.7.3a2.dist-info}/METADATA +1 -1
- {plugwise-1.7.3a1.dist-info → plugwise-1.7.3a2.dist-info}/RECORD +8 -8
- {plugwise-1.7.3a1.dist-info → plugwise-1.7.3a2.dist-info}/LICENSE +0 -0
- {plugwise-1.7.3a1.dist-info → plugwise-1.7.3a2.dist-info}/WHEEL +0 -0
- {plugwise-1.7.3a1.dist-info → plugwise-1.7.3a2.dist-info}/top_level.txt +0 -0
plugwise/common.py
CHANGED
@@ -76,6 +76,9 @@ class SmileCommon:
|
|
76
76
|
xml_2 = return_valid(xml_2, self._domain_objects)
|
77
77
|
self._heater_id = check_heater_central(xml_2)
|
78
78
|
|
79
|
+
if self._heater_id == NONE:
|
80
|
+
return Munch() # pragma: no cover
|
81
|
+
|
79
82
|
# Info for On-Off device
|
80
83
|
if self._on_off_device:
|
81
84
|
appl.name = "OnOff" # pragma: no cover
|
plugwise/helper.py
CHANGED
@@ -253,7 +253,7 @@ class SmileHelper(SmileCommon):
|
|
253
253
|
appl.zigbee_mac = module_data["zigbee_mac_address"]
|
254
254
|
return appl
|
255
255
|
case _: # pragma: no cover
|
256
|
-
return
|
256
|
+
return Munch()
|
257
257
|
|
258
258
|
def _appl_gateway_info(self, appl: Munch, appliance: etree.Element) -> Munch:
|
259
259
|
"""Helper-function for _appliance_info_finder()."""
|
plugwise/util.py
CHANGED
@@ -13,6 +13,7 @@ from plugwise.constants import (
|
|
13
13
|
ELECTRIC_POTENTIAL_VOLT,
|
14
14
|
ENERGY_KILO_WATT_HOUR,
|
15
15
|
HW_MODELS,
|
16
|
+
NONE,
|
16
17
|
OBSOLETE_MEASUREMENTS,
|
17
18
|
PERCENTAGE,
|
18
19
|
POWER_WATT,
|
@@ -93,14 +94,16 @@ def check_heater_central(xml: etree.Element) -> str:
|
|
93
94
|
if heater_central.find("name").text == "Central heating boiler":
|
94
95
|
hc_list.append({hc_id: has_actuators})
|
95
96
|
|
97
|
+
if not hc_list:
|
98
|
+
return NONE # pragma: no cover
|
99
|
+
|
96
100
|
heater_central_id = list(hc_list[0].keys())[0]
|
97
101
|
if hc_count > 1:
|
98
|
-
for item in hc_list:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
break # pragma: no cover
|
102
|
+
for item in hc_list:
|
103
|
+
hc_id, has_actuators = next(iter(item.items()))
|
104
|
+
if has_actuators:
|
105
|
+
heater_central_id = hc_id
|
106
|
+
break
|
104
107
|
|
105
108
|
return heater_central_id
|
106
109
|
|
@@ -135,7 +138,7 @@ def collect_power_values(
|
|
135
138
|
if not loc.found:
|
136
139
|
continue
|
137
140
|
|
138
|
-
|
141
|
+
power_data_energy_diff(loc.measurement, loc.net_string, loc.f_val, data)
|
139
142
|
key = cast(SensorType, loc.key_string)
|
140
143
|
data["sensors"][key] = loc.f_val
|
141
144
|
|
@@ -192,8 +195,6 @@ def escape_illegal_xml_characters(xmldata: str) -> str:
|
|
192
195
|
|
193
196
|
def format_measure(measure: str, unit: str) -> float | int:
|
194
197
|
"""Format measure to correct type."""
|
195
|
-
result: float | int = 0
|
196
|
-
|
197
198
|
float_measure = float(measure)
|
198
199
|
if unit == PERCENTAGE and 0 < float_measure <= 1:
|
199
200
|
return int(float_measure * 100)
|
@@ -202,13 +203,13 @@ def format_measure(measure: str, unit: str) -> float | int:
|
|
202
203
|
float_measure = float_measure / 1000
|
203
204
|
|
204
205
|
if unit in SPECIAL_FORMAT:
|
205
|
-
result =
|
206
|
+
result = round(float_measure, 3)
|
206
207
|
elif unit == ELECTRIC_POTENTIAL_VOLT:
|
207
|
-
result =
|
208
|
+
result = round(float_measure, 1)
|
208
209
|
elif abs(float_measure) < 10:
|
209
|
-
result =
|
210
|
-
|
211
|
-
result =
|
210
|
+
result = round(float_measure, 2)
|
211
|
+
else: # abs(float_measure) >= 10
|
212
|
+
result = round(float_measure, 1)
|
212
213
|
|
213
214
|
return result
|
214
215
|
|
@@ -228,31 +229,21 @@ def power_data_energy_diff(
|
|
228
229
|
net_string: SensorType,
|
229
230
|
f_val: float | int,
|
230
231
|
data: GwEntityData,
|
231
|
-
) ->
|
232
|
+
) -> None:
|
232
233
|
"""Calculate differential energy."""
|
233
234
|
if (
|
234
235
|
"electricity" in measurement
|
235
236
|
and "phase" not in measurement
|
236
237
|
and "interval" not in net_string
|
237
238
|
):
|
238
|
-
diff = 1
|
239
|
-
|
240
|
-
|
241
|
-
if
|
242
|
-
tmp_val
|
243
|
-
else:
|
244
|
-
tmp_val = data["sensors"][net_string]
|
245
|
-
|
246
|
-
if isinstance(f_val, int):
|
247
|
-
tmp_val += f_val * diff
|
248
|
-
else:
|
249
|
-
tmp_val += float(f_val * diff)
|
250
|
-
tmp_val = float(f"{round(tmp_val, 3):.3f}")
|
239
|
+
diff = 1 if "consumed" in measurement else -1
|
240
|
+
tmp_val = data["sensors"].get(net_string, 0)
|
241
|
+
tmp_val += f_val * diff
|
242
|
+
if isinstance(f_val, float):
|
243
|
+
tmp_val = round(tmp_val, 3)
|
251
244
|
|
252
245
|
data["sensors"][net_string] = tmp_val
|
253
246
|
|
254
|
-
return data
|
255
|
-
|
256
247
|
|
257
248
|
def power_data_local_format(
|
258
249
|
attrs: dict[str, str], key_string: str, val: str
|
@@ -1,18 +1,18 @@
|
|
1
1
|
plugwise/__init__.py,sha256=9Bc3Kaajvr-W060CVW135rPxkdQIh6wlv0jeo57zmWA,17786
|
2
|
-
plugwise/common.py,sha256=
|
2
|
+
plugwise/common.py,sha256=Q2P4iyLcrGLeZwNd8Z8soWhI3L5L9IWMgaIMnppsIEs,9475
|
3
3
|
plugwise/constants.py,sha256=Vd8tvOHsRtZxtUUFXBXolZj3QiKnxRt0bnwDT9DoEqE,17073
|
4
4
|
plugwise/data.py,sha256=SUXbyjCu-wS6l3tXnAhItEOhnYtAfd79nPiUlS5MnzY,12955
|
5
5
|
plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
|
6
|
-
plugwise/helper.py,sha256=
|
6
|
+
plugwise/helper.py,sha256=U1EUqX3ErmmFH4L5uXRAXNj20toeMufzyKp2-WRpIXc,39483
|
7
7
|
plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
plugwise/smile.py,sha256=BHgOp9FaaupOghF54t53qpgnQoVdG4WfdOSUPI2dmKc,19559
|
9
9
|
plugwise/smilecomm.py,sha256=DRQ3toRNEf3oo_mej49fPJ47m5das-jvo-8GnIrSPzw,5208
|
10
|
-
plugwise/util.py,sha256=
|
10
|
+
plugwise/util.py,sha256=rMcqfaB4dkQEZFJY-bBJISmlYgTnb6Ns3-Doxelf92Q,10689
|
11
11
|
plugwise/legacy/data.py,sha256=s2WYjgxwcuAGS8UOxJVf7xLSxS38Zgr8GsjxlxfD98w,3574
|
12
12
|
plugwise/legacy/helper.py,sha256=MLEeZO4vcHTrjRUb0ZMch_5aHABXmdEiQZNpCmJdWiw,17156
|
13
13
|
plugwise/legacy/smile.py,sha256=bbhuD0kT9xuzdRd6shl-IBRUkBlforYv-iggJXYYrU0,12850
|
14
|
-
plugwise-1.7.
|
15
|
-
plugwise-1.7.
|
16
|
-
plugwise-1.7.
|
17
|
-
plugwise-1.7.
|
18
|
-
plugwise-1.7.
|
14
|
+
plugwise-1.7.3a2.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
|
15
|
+
plugwise-1.7.3a2.dist-info/METADATA,sha256=sF2g1_meY9DJgPi8QtlWJlU95lC77Y3hGdGj7olCdXA,9330
|
16
|
+
plugwise-1.7.3a2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
17
|
+
plugwise-1.7.3a2.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
|
18
|
+
plugwise-1.7.3a2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|