PyBLNET 0.11.0__tar.gz → 0.12.0__tar.gz
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.
- {pyblnet-0.11.0 → pyblnet-0.12.0}/PKG-INFO +3 -3
- {pyblnet-0.11.0 → pyblnet-0.12.0}/README.md +2 -2
- {pyblnet-0.11.0 → pyblnet-0.12.0}/pyblnet/__init__.py +1 -1
- {pyblnet-0.11.0 → pyblnet-0.12.0}/pyblnet/blnet.py +6 -2
- {pyblnet-0.11.0 → pyblnet-0.12.0}/pyblnet/blnet_parser.py +2 -1
- {pyblnet-0.11.0 → pyblnet-0.12.0}/pyblnet/blnet_web.py +47 -18
- {pyblnet-0.11.0 → pyblnet-0.12.0}/pyproject.toml +1 -1
- {pyblnet-0.11.0 → pyblnet-0.12.0}/LICENSE.txt +0 -0
- {pyblnet-0.11.0 → pyblnet-0.12.0}/pyblnet/blnet_conn.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: PyBLNET
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: Automate wireless communication to UVR1611 via BL-NET
|
|
5
5
|
Keywords: python,uvr1611,blnet,technische alternative,home automation,iot
|
|
6
6
|
Author-email: nielstron <n.muendler@posteo.de>
|
|
@@ -24,8 +24,8 @@ Provides-Extra: test
|
|
|
24
24
|
Import-Name: pyblnet
|
|
25
25
|
|
|
26
26
|
# PyBLNET - a very basic python BL-NET bridge
|
|
27
|
-

|
|
28
|
-

|
|
27
|
+
[](https://pypi.org/project/PyBLNET/)
|
|
28
|
+
[](https://pypi.org/project/PyBLNET/)
|
|
29
29
|
[](https://github.com/nielstron/pyblnet/actions/workflows/build.yml)
|
|
30
30
|
[](https://coveralls.io/github/nielstron/pyblnet?branch=master)
|
|
31
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# PyBLNET - a very basic python BL-NET bridge
|
|
2
|
-

|
|
3
|
-

|
|
2
|
+
[](https://pypi.org/project/PyBLNET/)
|
|
3
|
+
[](https://pypi.org/project/PyBLNET/)
|
|
4
4
|
[](https://github.com/nielstron/pyblnet/actions/workflows/build.yml)
|
|
5
5
|
[](https://coveralls.io/github/nielstron/pyblnet?branch=master)
|
|
6
6
|
|
|
@@ -96,7 +96,8 @@ class BLNET(object):
|
|
|
96
96
|
data["analog"] = self._convert_web(blnet_session.read_analog_values())
|
|
97
97
|
data["digital"] = self._convert_web(blnet_session.read_digital_values())
|
|
98
98
|
for entry in data["analog"].values():
|
|
99
|
-
|
|
99
|
+
# digital inputs come with their type, others by their unit
|
|
100
|
+
entry.setdefault("type", WEB_UNIT_TYPES.get(entry.get("unit_of_measurement")))
|
|
100
101
|
if self.blnet_direct:
|
|
101
102
|
direct = self.blnet_direct.get_latest(self.max_retries)[0]
|
|
102
103
|
# Override values for analog and digital as values are
|
|
@@ -104,7 +105,10 @@ class BLNET(object):
|
|
|
104
105
|
for domain in ["analog", "digital"]:
|
|
105
106
|
for id, value in direct[domain].items():
|
|
106
107
|
if data[domain].get(id) is not None:
|
|
107
|
-
|
|
108
|
+
# Keep the web value if the direct one is missing: a
|
|
109
|
+
# UVR1611 on CAN sends digital inputs as unused inputs
|
|
110
|
+
if value is not None:
|
|
111
|
+
data[domain][id]["value"] = value
|
|
108
112
|
elif not self.blnet_web:
|
|
109
113
|
if value is None:
|
|
110
114
|
continue
|
|
@@ -27,7 +27,8 @@ TYPE_NONE = 0x0000
|
|
|
27
27
|
TYPE_DIGITAL = 0x1000
|
|
28
28
|
TYPE_TEMP = 0x2000
|
|
29
29
|
TYPE_VOLUME = 0x3000
|
|
30
|
-
|
|
30
|
+
# V110 TTTT TTTT TTTT in TA's interface spec, in W/m²
|
|
31
|
+
TYPE_RADIATION = 0x6000
|
|
31
32
|
TYPE_RAS = 0x7000
|
|
32
33
|
RAS_POSITIVE_MASK = 0x01FF
|
|
33
34
|
# Temperature input without sensor (or with a broken wire): all value bits set, 409.5 °C
|
|
@@ -15,6 +15,24 @@ import re
|
|
|
15
15
|
from builtins import int
|
|
16
16
|
from html.parser import HTMLParser
|
|
17
17
|
|
|
18
|
+
# An input on the inputs page: a measured value with unit, or the state of a
|
|
19
|
+
# digital input. The value of a digital input is "1" (on) or "0" (off), like
|
|
20
|
+
# the direct connection reports it.
|
|
21
|
+
INPUT_PATTERN = re.compile(
|
|
22
|
+
r"(?P<id>\d+): (?P<name>.+)\n( ){3,6}"
|
|
23
|
+
r"(?:(?P<value>(- )?\d+,\d+) (?P<unit_of_measurement>.+?) "
|
|
24
|
+
r"|(?P<state>AUS|EIN|OFF|ON)( )+)PAR?"
|
|
25
|
+
)
|
|
26
|
+
DIGITAL_INPUT_STATES = {"AUS": "0", "OFF": "0", "EIN": "1", "ON": "1"}
|
|
27
|
+
|
|
28
|
+
# A mixer on the outputs page: its mode, then the state of the opening output
|
|
29
|
+
# and of the closing output, which has the next id
|
|
30
|
+
MIXER_OUTPUT_PATTERN = re.compile(
|
|
31
|
+
r"(?P<id>\d+): (?P<name>.+)\n( )+(?P<mode>AUTO|HAND) .*PAR\?.*\n"
|
|
32
|
+
r"( )+auf:( )+(?P<open>AUS|EIN)\n"
|
|
33
|
+
r"( )*(?P<id_close>\d+): zu:( )+(?P<close>AUS|EIN)"
|
|
34
|
+
)
|
|
35
|
+
|
|
18
36
|
|
|
19
37
|
class _ElementTextParser(HTMLParser):
|
|
20
38
|
"""
|
|
@@ -256,24 +274,24 @@ class BLNETWeb(object):
|
|
|
256
274
|
data = list()
|
|
257
275
|
|
|
258
276
|
# search for data by regular expression
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
data.append(
|
|
277
|
+
for match in INPUT_PATTERN.finditer(data_raw):
|
|
278
|
+
# convert html entities to unicode characters,
|
|
279
|
+
# replace by " " since it is not unescaped as expected
|
|
280
|
+
entry = {
|
|
281
|
+
"id": match["id"],
|
|
282
|
+
"name": html.unescape(match["name"].replace(" ", " ")),
|
|
283
|
+
}
|
|
284
|
+
if match["state"] is not None:
|
|
285
|
+
entry["value"] = DIGITAL_INPUT_STATES[match["state"]]
|
|
286
|
+
entry["unit_of_measurement"] = None
|
|
287
|
+
entry["type"] = "digital"
|
|
288
|
+
else:
|
|
289
|
+
# replace decimal "," by "." and remove " " completely
|
|
290
|
+
entry["value"] = match["value"].replace(" ", "").replace(",", ".")
|
|
291
|
+
entry["unit_of_measurement"] = html.unescape(
|
|
292
|
+
match["unit_of_measurement"].replace(" ", " ")
|
|
293
|
+
)
|
|
294
|
+
data.append(entry)
|
|
277
295
|
return data
|
|
278
296
|
|
|
279
297
|
def read_digital_values(self):
|
|
@@ -316,6 +334,17 @@ class BLNETWeb(object):
|
|
|
316
334
|
match_dict[key] = html.unescape(value)
|
|
317
335
|
# and append formatted dict
|
|
318
336
|
data.append(match_dict)
|
|
337
|
+
# a mixer uses two outputs (open, close) with a common mode
|
|
338
|
+
for match in MIXER_OUTPUT_PATTERN.finditer(data_raw):
|
|
339
|
+
name = html.unescape(match["name"].replace(" ", " "))
|
|
340
|
+
for id, direction, value in [
|
|
341
|
+
(match["id"], "auf", match["open"]),
|
|
342
|
+
(match["id_close"], "zu", match["close"]),
|
|
343
|
+
]:
|
|
344
|
+
data.append(
|
|
345
|
+
{"id": id, "name": f"{name} {direction}", "mode": match["mode"], "value": value}
|
|
346
|
+
)
|
|
347
|
+
data.sort(key=lambda entry: int(entry["id"]))
|
|
319
348
|
return data
|
|
320
349
|
|
|
321
350
|
def set_digital_value(self, digital_id, value):
|
|
File without changes
|
|
File without changes
|