PyBLNET 0.9.5__py3-none-any.whl → 0.11.0__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.
pyblnet/__init__.py CHANGED
@@ -4,17 +4,11 @@
4
4
  import warnings
5
5
 
6
6
  try:
7
- from .blnet_web import BLNETWeb, test_blnet
7
+ from .blnet_web import BLNETWeb, blnet_test
8
8
  from .blnet_conn import BLNETDirect
9
9
  from .blnet import BLNET
10
10
  except ImportError as e:
11
11
  warnings.warn(ImportWarning(e))
12
12
 
13
- VERSION = (0, 9, 5)
13
+ VERSION = (0, 11, 0)
14
14
 
15
- __version__ = ".".join([str(i) for i in VERSION])
16
- __author__ = "nielstron"
17
- __author_email__ = "n.muendler@web.de"
18
- __copyright__ = "Copyright (C) 2019 nielstron"
19
- __license__ = "MIT"
20
- __url__ = "https://github.com/nielstron/pyblnet"
pyblnet/blnet.py CHANGED
@@ -12,10 +12,17 @@ as possible.
12
12
  """
13
13
  from .blnet_web import BLNETWeb
14
14
  from .blnet_conn import BLNETDirect
15
+ from .blnet_parser import ANALOG_UNITS
15
16
 
16
17
  from urllib.parse import urlparse
17
18
 
18
19
 
20
+ # Units of the values only available via BLNETDirect, speed is a level 0-30
21
+ UNITS = {"speed": None, "energy": "kWh", "power": "kW"}
22
+ # Analog input type for the units shown by the web interface
23
+ WEB_UNIT_TYPES = {unit: input_type for input_type, unit in ANALOG_UNITS.items() if unit is not None}
24
+
25
+
19
26
  class BLNET(object):
20
27
  """
21
28
  General high-level BLNET interface.
@@ -68,7 +75,7 @@ class BLNET(object):
68
75
  # especially not if not prefixed with http://
69
76
  # see https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse
70
77
  host = urlparse(address).hostname or address
71
- self.blnet_direct = BLNETDirect(host, ta_port)
78
+ self.blnet_direct = BLNETDirect(host, ta_port, timeout=timeout)
72
79
 
73
80
  def fetch(self, node=None):
74
81
  """
@@ -88,6 +95,8 @@ class BLNET(object):
88
95
  blnet_session.set_node(node)
89
96
  data["analog"] = self._convert_web(blnet_session.read_analog_values())
90
97
  data["digital"] = self._convert_web(blnet_session.read_digital_values())
98
+ for entry in data["analog"].values():
99
+ entry["type"] = WEB_UNIT_TYPES.get(entry.get("unit_of_measurement"))
91
100
  if self.blnet_direct:
92
101
  direct = self.blnet_direct.get_latest(self.max_retries)[0]
93
102
  # Override values for analog and digital as values are
@@ -96,11 +105,20 @@ class BLNET(object):
96
105
  for id, value in direct[domain].items():
97
106
  if data[domain].get(id) is not None:
98
107
  data[domain][id]["value"] = value
108
+ elif not self.blnet_web:
109
+ if value is None:
110
+ continue
111
+ data[domain][id] = {"value": value}
112
+ if domain == "analog":
113
+ input_type = direct["analog_types"][id]
114
+ data[domain][id]["type"] = input_type
115
+ data[domain][id]["unit_of_measurement"] = ANALOG_UNITS.get(input_type)
116
+
99
117
  for domain in ["speed", "energy", "power"]:
100
118
  for id, value in direct[domain].items():
101
119
  if value is None:
102
120
  continue
103
- data[domain][id] = {"value": value}
121
+ data[domain][id] = {"value": value, "unit_of_measurement": UNITS[domain]}
104
122
  return data
105
123
 
106
124
  def turn_on(self, digital_id, can_node=None):
@@ -162,8 +180,11 @@ class BLNET(object):
162
180
  if cached is None:
163
181
  cached = self.fetch()
164
182
  for key, v in cached[type].items():
165
- if str(v["name"]) == str(name) or str(v["id"]) == str(id):
166
- val = v[ret]
183
+ # values fetched only via blnet_direct have no name
184
+ if (name is not None and str(v.get("name")) == str(name)) or (
185
+ id is not None and str(key) == str(id)
186
+ ):
187
+ val = v.get(ret)
167
188
  dic = v
168
189
 
169
190
  return val, dic, cached
pyblnet/blnet_conn.py CHANGED
@@ -10,6 +10,7 @@ https://github.com/berwinter/uvr1611/blob/master/lib/backend/blnet-connection.in
10
10
  """
11
11
  from builtins import str, int
12
12
  from socket import socket, getaddrinfo, SOCK_STREAM, IPPROTO_TCP
13
+ import functools
13
14
  import struct
14
15
  from time import sleep
15
16
  from datetime import datetime
@@ -27,11 +28,37 @@ READ_DATA = 0xAC
27
28
  END_READ = b"\xAD"
28
29
  RESET_DATA = b"\xAF"
29
30
  WAIT_TIME = 0xBA
31
+ # Seconds to wait when the BL-Net has no new data yet. Real devices answer
32
+ # GET_LATEST with "no data" for up to about 5 seconds after a read.
33
+ NO_DATA_WAIT = 2
30
34
  MAX_RETRYS = 10
35
+ # Length of a WAIT_TIME reply: 0xBA, seconds to wait, checksum
36
+ WAIT_SIZE = 3
31
37
  DATASET_SIZE = 61
32
38
  LATEST_SIZE = 56
33
39
 
34
40
 
41
+ def _reset_on_error(method):
42
+ """
43
+ Close the connection and forget the read state if a read fails,
44
+ so that the next call starts with a fresh connection.
45
+ Malformed replies are raised as ConnectionError.
46
+ """
47
+
48
+ @functools.wraps(method)
49
+ def wrapper(self, *args, **kwargs):
50
+ try:
51
+ return method(self, *args, **kwargs)
52
+ except (struct.error, IndexError, ValueError) as ex:
53
+ self._reset()
54
+ raise ConnectionError(f"Invalid reply from BL-Net: {ex}") from ex
55
+ except BaseException:
56
+ self._reset()
57
+ raise
58
+
59
+ return wrapper
60
+
61
+
35
62
  class BLNETDirect(object):
36
63
  """
37
64
  A class for establishing a direct connection to the BLNET (rather than
@@ -41,12 +68,13 @@ class BLNETDirect(object):
41
68
  www.haus-terra.at/heizung/download/Schnittstelle/Schnittstelle_PC_Bootloader.pdf
42
69
  """
43
70
 
44
- def __init__(self, address, port=40000, reset=False):
71
+ def __init__(self, address, port: int = 40000, reset: bool = False, timeout: float = 60):
45
72
  """
46
73
  Constructor
47
- @param address: string, Address of the BL-Net device
48
- @param port: integer, Port of the bl-net device for connection
49
- @param reset: boolean, delete data on BL-Net after data receive
74
+ :param address: string, Address of the BL-Net device
75
+ :param port: integer, Port of the bl-net device for connection
76
+ :param reset: boolean, delete data on BL-Net after data receive
77
+ :param timeout: float, timeout in seconds for the connection
50
78
  """
51
79
  assert isinstance(address, str)
52
80
  assert isinstance(port, int)
@@ -54,11 +82,14 @@ class BLNETDirect(object):
54
82
  self.address = address
55
83
  self.port = port
56
84
  self.reset = reset
85
+ # 0 would make the socket non-blocking, treat it like None (no timeout)
86
+ self._timeout = timeout or None
57
87
  self._mode = None
58
88
  self._socket = None
59
89
  self._count = None
60
90
  self._check_mode()
61
91
 
92
+ @_reset_on_error
62
93
  def get_count(self):
63
94
  """
64
95
  Get the number of datasets in the bootloader memory
@@ -87,7 +118,7 @@ class BLNETDirect(object):
87
118
  self._fetch_size = 4 + 61 * frame_count
88
119
  elif self._mode == DL_MODE:
89
120
  (_, device, start_address, end_address, checksum) = struct.unpack(
90
- "<5sB3s3sB"
121
+ "<5sB3s3sB", data
91
122
  )
92
123
  self._address_inc = 64
93
124
  self._can_frames = 1
@@ -95,7 +126,7 @@ class BLNETDirect(object):
95
126
  self._fetch_size = 65
96
127
  elif self._mode == DL2_MODE:
97
128
  (_, device, start_address, end_address, checksum) = struct.unpack(
98
- "<5s2s3s3sB"
129
+ "<5s2s3s3sB", data
99
130
  )
100
131
  self._address_inc = 128
101
132
  self._can_frames = 1
@@ -125,20 +156,18 @@ class BLNETDirect(object):
125
156
  else:
126
157
  raise ConnectionError("Could not retreive count")
127
158
 
159
+ @_reset_on_error
128
160
  def _get_data(self, max_count=None):
129
161
  data = []
130
- try:
131
- count = self._start_read()
132
- if isinstance(max_count, int):
133
- count = min(max_count, count)
134
- for _ in range(0, count):
135
- data.append(self._fetch_data())
136
- self._end_read(True)
137
- return data
138
- finally:
139
- self._end_read(False)
140
- return data
162
+ count = self._start_read()
163
+ if isinstance(max_count, int):
164
+ count = min(max_count, count)
165
+ for _ in range(0, count):
166
+ data.append(self._fetch_data())
167
+ self._end_read(True)
168
+ return data
141
169
 
170
+ @_reset_on_error
142
171
  def _check_mode(self):
143
172
  """
144
173
  Check if Bootloader Mode is supported
@@ -164,9 +193,11 @@ class BLNETDirect(object):
164
193
  for (family, socktype, proto, _, sockaddr) in available:
165
194
  try:
166
195
  self._socket = socket(family, socktype, proto)
196
+ self._socket.settimeout(self._timeout)
167
197
  self._socket.connect(sockaddr)
168
198
  break
169
- except:
199
+ except OSError:
200
+ self._socket.close()
170
201
  self._socket = None
171
202
  if self._socket is None:
172
203
  raise ConnectionError("Could not connect to BLNET")
@@ -178,26 +209,67 @@ class BLNETDirect(object):
178
209
  self._socket.close()
179
210
  self._socket = None
180
211
 
212
+ def _reset(self):
213
+ """
214
+ Close the connection if open and forget the read state
215
+ """
216
+ if self._socket is not None:
217
+ self._disconnect()
218
+ self._count = None
219
+ self._address = None
220
+
181
221
  def _query(self, command, length):
182
222
  """
183
223
  Send a command to the bootloader and wait for the response
184
224
  if response is less then 32 bytes long return immediately
185
225
  @param commmand: string only ascii (needs byte length == string length)
186
226
  @param length: int length of response
187
- @throws ConnectionError error when querying
227
+ @throws ConnectionError BL-Net closed the connection
188
228
  @return Binary: byte string
189
229
  """
190
- if len(command) == self._socket.send(command):
191
- data = b""
192
- # get response until length or less than 32 bytes
193
- while True:
194
- data += self._socket.recv(length)
195
- if len(data) <= 32 or len(data) >= length:
196
- break
197
- return data
198
-
199
- self._disconnect()
200
- raise ConnectionError("Error while querying command {}".format(command))
230
+ self._socket.sendall(command)
231
+ data = b""
232
+ # get response until length or less than 32 bytes
233
+ while True:
234
+ received = self._socket.recv(length)
235
+ if not received:
236
+ raise ConnectionError("BL-Net closed the connection")
237
+ data += received
238
+ if len(data) <= 32 or len(data) >= length:
239
+ break
240
+ return data
241
+
242
+ def _recv_exact(self, length):
243
+ """
244
+ Receive exactly length bytes
245
+ @throws ConnectionError BL-Net closed the connection
246
+ @return Binary: byte string
247
+ """
248
+ data = b""
249
+ while len(data) < length:
250
+ received = self._socket.recv(length - len(data))
251
+ if not received:
252
+ raise ConnectionError("BL-Net closed the connection")
253
+ data += received
254
+ return data
255
+
256
+ def _query_latest(self, command):
257
+ """
258
+ Send a GET_LATEST command and receive the complete reply.
259
+ The BL-Net may send a reply in several TCP segments, so the length
260
+ is derived from its first byte and the reply is read completely.
261
+ Reading only part of it would leave the rest in the socket and
262
+ shift every following reply by some bytes.
263
+ @return Binary: byte string, a "no data", "wait" or data reply
264
+ """
265
+ self._socket.sendall(command)
266
+ first = self._recv_exact(1)
267
+ if first[0] == GET_LATEST:
268
+ # no new data available yet
269
+ return first
270
+ if first[0] == WAIT_TIME:
271
+ return first + self._recv_exact(WAIT_SIZE - 1)
272
+ return first + self._recv_exact(self._actual_size - 1)
201
273
 
202
274
  def _start_read(self):
203
275
  """
@@ -305,6 +377,7 @@ class BLNETDirect(object):
305
377
  self._address = None
306
378
  self._disconnect()
307
379
 
380
+ @_reset_on_error
308
381
  def get_latest(self, max_retries=MAX_RETRYS):
309
382
  """
310
383
  Fetch latest (current) data from the BLNet
@@ -315,7 +388,7 @@ class BLNETDirect(object):
315
388
  self._connect()
316
389
  self.get_count()
317
390
  frames = {}
318
- info = {"sleep": {}, "got": {}}
391
+ info = {"sleep": {}, "got": {}, "timeout": []}
319
392
 
320
393
  # for all frames
321
394
  for frame in range(0, self._can_frames):
@@ -324,9 +397,12 @@ class BLNETDirect(object):
324
397
  # try 4 times
325
398
  sleeps = []
326
399
  for n in range(0, max_retries):
327
- data = self._query(command, self._actual_size)
400
+ data = self._query_latest(command)
328
401
 
329
- if self._checksum(data):
402
+ if data == bytes([GET_LATEST]):
403
+ # no new data available yet ("Synchronisation" in TA's spec)
404
+ sleep(NO_DATA_WAIT)
405
+ elif self._checksum(data):
330
406
  binary = struct.unpack("<{}".format("B" * len(data)), data)
331
407
 
332
408
  if binary[0] == WAIT_TIME:
@@ -339,9 +415,14 @@ class BLNETDirect(object):
339
415
  info["got"][frame] = n
340
416
  frames.update(self._split_latest(data, frame))
341
417
  break
342
- # TODO this looks suspicious
343
- if n == max_retries - 1:
344
- frames[frame] = "timeout"
418
+ else:
419
+ # Unexpected bytes may still be on their way, reconnect
420
+ # so that they can't end up in the next reply
421
+ self._disconnect()
422
+ self._connect()
423
+ else:
424
+ # BL-Net did not send data for this frame within max_retries
425
+ info["timeout"].append(frame)
345
426
  info["sleep"][frame] = sleeps
346
427
  self._end_read(True)
347
428
  if len(frames) > 0:
pyblnet/blnet_parser.py CHANGED
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Created on 09.08.2018
5
5
 
6
- This is basically a python port of of a script by berwinter
6
+ This is basically a python port of a script by berwinter
7
7
  https://github.com/berwinter/uvr1611/blob/master/lib/backend/blnet-connection.inc.php
8
8
 
9
9
  author: Niels
@@ -30,10 +30,28 @@ TYPE_VOLUME = 0x3000
30
30
  TYPE_RADIATION = 0x4000
31
31
  TYPE_RAS = 0x7000
32
32
  RAS_POSITIVE_MASK = 0x01FF
33
+ # Temperature input without sensor (or with a broken wire): all value bits set, 409.5 °C
34
+ TEMP_NO_SENSOR = TYPE_TEMP | POSITIVE_VALUE_MASK
33
35
  # 32 bit
34
36
  INT32_MASK = 0xFFFFFFFF
35
37
  INT32_SIGN = 0x80000000
36
38
 
39
+ # Names of the analog input types, unused and undocumented types have none
40
+ ANALOG_TYPES = {
41
+ TYPE_DIGITAL: "digital",
42
+ TYPE_TEMP: "temperature",
43
+ TYPE_VOLUME: "volume_flow",
44
+ TYPE_RADIATION: "radiation",
45
+ TYPE_RAS: "temperature",
46
+ }
47
+ # Units of the analog input types, as the web interface shows them
48
+ ANALOG_UNITS = {
49
+ "digital": None,
50
+ "temperature": "°C",
51
+ "volume_flow": "l/h",
52
+ "radiation": "W/m²",
53
+ }
54
+
37
55
 
38
56
  class BLNETParser:
39
57
  def __init__(self, data):
@@ -71,8 +89,11 @@ class BLNETParser:
71
89
  analog = struct.unpack("<{}{}".format("H" * 16, "x" * (len(data) - 32)), data)
72
90
 
73
91
  self.analog = {}
92
+ self.analog_types = {}
74
93
  for channel in range(0, 16):
75
- self.analog[channel + 1] = round(self._convert_analog(analog[channel]), 3)
94
+ self.analog_types[channel + 1] = ANALOG_TYPES.get(analog[channel] & TYPE_MASK)
95
+ value = self._convert_analog(analog[channel])
96
+ self.analog[channel + 1] = None if value is None else round(value, 3)
76
97
 
77
98
  self.digital = {}
78
99
  for channel in range(0, 16):
@@ -107,7 +128,12 @@ class BLNETParser:
107
128
  """
108
129
 
109
130
  mask = value & TYPE_MASK
110
- if mask == TYPE_TEMP:
131
+ if mask == TYPE_NONE:
132
+ # input is unused
133
+ return None
134
+ elif value == TEMP_NO_SENSOR:
135
+ return None
136
+ elif mask == TYPE_TEMP:
111
137
  return self._calculate_value(value, 0.1)
112
138
  elif mask == TYPE_VOLUME:
113
139
  return self._calculate_value(value, 4)
@@ -118,7 +144,8 @@ class BLNETParser:
118
144
  return 0
119
145
  elif mask == TYPE_RAS:
120
146
  return self._calculate_value(value, 0.1, RAS_POSITIVE_MASK)
121
- elif mask in [TYPE_RADIATION, TYPE_NONE] or True:
147
+ else:
148
+ # TYPE_RADIATION and types not covered by the interface spec
122
149
  return self._calculate_value(value)
123
150
 
124
151
  def _convert_digital(self, value, position):
@@ -144,7 +171,7 @@ class BLNETParser:
144
171
  Check if heat meter is activated on a given position
145
172
  @return its energy
146
173
  """
147
- if active & position:
174
+ if active & (1 << position):
148
175
  kwh = self._calculate_value(kwh, 0.1, INT16_POSITIVE_MASK)
149
176
  return round(mwh * 1000 + kwh, 3)
150
177
  else:
@@ -155,7 +182,7 @@ class BLNETParser:
155
182
  checks if heat meter is activated at given position
156
183
  @return its power
157
184
  """
158
- if active & position:
185
+ if active & (1 << position):
159
186
  value = self._calculate_value(value, 1 / 2560, INT32_MASK, INT32_SIGN)
160
187
  value = round(value, 3)
161
188
  return value
pyblnet/blnet_web.py CHANGED
@@ -10,13 +10,77 @@ via it's HTTP-interface
10
10
  """
11
11
 
12
12
  import requests
13
- from htmldom import htmldom
14
13
  import html
15
14
  import re
16
15
  from builtins import int
16
+ from html.parser import HTMLParser
17
17
 
18
18
 
19
- def test_blnet(ip, timeout=5, id=0):
19
+ class _ElementTextParser(HTMLParser):
20
+ """
21
+ Collects the text of all elements with the given tag and class or id.
22
+ Entities like &nbsp; are kept as written and <br> becomes a newline,
23
+ which is what the regular expressions below expect.
24
+ """
25
+
26
+ def __init__(self, tag, cls=None, id=None):
27
+ super().__init__(convert_charrefs=False)
28
+ self.tag = tag
29
+ self.cls = cls
30
+ self.id = id
31
+ # text of each matching element, in document order
32
+ self.texts = []
33
+ # for each open element with self.tag: its index in self.texts,
34
+ # or None if it doesn't match. Matching elements can be nested.
35
+ self._open = []
36
+
37
+ def _matches(self, attrs):
38
+ attrs = dict(attrs)
39
+ return (self.cls is None or self.cls in (attrs.get("class") or "").split()) and (
40
+ self.id is None or attrs.get("id") == self.id
41
+ )
42
+
43
+ def handle_starttag(self, tag, attrs):
44
+ if tag == self.tag:
45
+ if self._matches(attrs):
46
+ self.texts.append("")
47
+ self._open.append(len(self.texts) - 1)
48
+ else:
49
+ self._open.append(None)
50
+ elif tag == "br":
51
+ self.handle_data("\n")
52
+
53
+ def handle_endtag(self, tag):
54
+ if tag == self.tag and self._open:
55
+ self._open.pop()
56
+
57
+ def handle_data(self, data):
58
+ for index in self._open:
59
+ if index is not None:
60
+ self.texts[index] += data
61
+
62
+ def handle_entityref(self, name):
63
+ self.handle_data(f"&{name};")
64
+
65
+ def handle_charref(self, name):
66
+ self.handle_data(f"&#{name};")
67
+
68
+
69
+ def _element_texts(page, tag, cls=None, id=None):
70
+ """Texts of all elements in page with the given tag and class or id"""
71
+ parser = _ElementTextParser(tag, cls, id)
72
+ parser.feed(page)
73
+ parser.close()
74
+ return parser.texts
75
+
76
+
77
+ def _element_text(page, tag, cls=None, id=None):
78
+ """Text of the first such element, empty if there is none"""
79
+ texts = _element_texts(page, tag, cls, id)
80
+ return texts[0] if texts else ""
81
+
82
+
83
+ def blnet_test(ip, timeout=5, id=0):
20
84
  """
21
85
  Tests whether an BLNET answers under given ip
22
86
  Attributes:
@@ -28,13 +92,11 @@ def test_blnet(ip, timeout=5, id=0):
28
92
  r = requests.get(ip, timeout=timeout)
29
93
  except requests.exceptions.RequestException:
30
94
  return False
31
- # Parse DOM object from HTMLCode
32
- dom = htmldom.HtmlDom().createDom(r.text)
33
95
  # either a 'Zugriff verweigert' message is shown
34
- if "BL-Net".lower() in dom.find("title").text().lower():
96
+ if "BL-Net".lower() in _element_text(r.text, "title").lower():
35
97
  return True
36
98
  # or (more often) the BL-NET Menü
37
- if "BL-NET" in dom.find("div#head").text():
99
+ if "BL-NET" in _element_text(r.text, "div", id="head"):
38
100
  return True
39
101
  return False
40
102
 
@@ -63,7 +125,7 @@ class BLNETWeb(object):
63
125
  assert timeout is None or isinstance(timeout, int)
64
126
  if not ip.startswith("http://") and not ip.startswith("https://"):
65
127
  ip = "http://" + ip
66
- if not test_blnet(ip):
128
+ if not blnet_test(ip):
67
129
  raise ValueError("No BLNET found under given address: {}".format(ip))
68
130
  self.ip = ip
69
131
  self.password = password
@@ -183,18 +245,12 @@ class BLNETWeb(object):
183
245
  )
184
246
  except requests.exceptions.RequestException:
185
247
  return None
186
- # Parse DOM object from HTMLCode
187
- dom = htmldom.HtmlDom().createDom(r.text)
188
- # Check if we didn't fail in access
189
- # if 'BL-Net Zugang verweigert' in dom.find('title').text():
190
- # return None
191
248
  # get the element containing the interesting information
192
- dom = dom.find("div.c")[1]
249
+ texts = _element_texts(r.text, "div", cls="c")
193
250
  # in case of access denied or other errors, return None
194
- if dom is None:
195
- return dom
196
- # filter out the text
197
- data_raw = dom.text()
251
+ if len(texts) < 2:
252
+ return None
253
+ data_raw = texts[1]
198
254
 
199
255
  # collect data in an array
200
256
  data = list()
@@ -234,18 +290,14 @@ class BLNETWeb(object):
234
290
  )
235
291
  except requests.exceptions.RequestException:
236
292
  return None
237
- # Parse DOM object from HTMLCode
238
- dom = htmldom.HtmlDom().createDom(r.text)
239
293
  # Check if we didn't fail in access
240
- if "BL-Net Zugang verweigert" in dom.find("title").text():
294
+ if "BL-Net Zugang verweigert" in _element_text(r.text, "title"):
241
295
  return None
242
296
  # get the element containing the interesting information
243
- dom = dom.find("div.c")[1]
244
- if dom is None:
297
+ texts = _element_texts(r.text, "div", cls="c")
298
+ if len(texts) < 2:
245
299
  return None
246
-
247
- # filter out the text
248
- data_raw = dom.text()
300
+ data_raw = texts[1]
249
301
 
250
302
  # collect data in an array
251
303
  data = list()
@@ -1,31 +1,31 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.5
2
2
  Name: PyBLNET
3
- Version: 0.9.5
3
+ Version: 0.11.0
4
4
  Summary: Automate wireless communication to UVR1611 via BL-NET
5
- Home-page: https://github.com/nielstron/pyblnet/
6
- Author: nielstron
7
- Author-email: n.muendler@web.de
8
- License: MIT
9
- Keywords: python uvr1611 blnet technische alternative home automation iot
5
+ Keywords: python,uvr1611,blnet,technische alternative,home automation,iot
6
+ Author-email: nielstron <n.muendler@posteo.de>
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
10
9
  Classifier: Development Status :: 4 - Beta
11
10
  Classifier: Intended Audience :: Developers
12
11
  Classifier: Topic :: Software Development :: Object Brokering
13
12
  Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3.4
15
- Classifier: Programming Language :: Python :: 3.5
16
- Classifier: Programming Language :: Python :: 3.6
17
- Classifier: Programming Language :: Python :: 3.7
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
13
  Classifier: Programming Language :: Python :: 3.10
21
14
  Classifier: Programming Language :: Python :: 3.11
22
- Requires-Python: >=3
23
- Description-Content-Type: text/markdown
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: 3.15
24
19
  License-File: LICENSE.txt
25
- Requires-Dist: htmldom
26
20
  Requires-Dist: requests
21
+ Requires-Dist: pytest ; extra == "test"
22
+ Project-URL: Homepage, https://github.com/PyBLNET/pyblnet/
23
+ Provides-Extra: test
24
+ Import-Name: pyblnet
27
25
 
28
26
  # PyBLNET - a very basic python BL-NET bridge
27
+ ![PyPI - Version](https://img.shields.io/pypi/v/pyblnet)
28
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyblnet)
29
29
  [![Build status](https://github.com/nielstron/pyblnet/actions/workflows/build.yml/badge.svg)](https://github.com/nielstron/pyblnet/actions/workflows/build.yml)
30
30
  [![Coverage Status](https://coveralls.io/repos/github/nielstron/pyblnet/badge.svg?branch=master)](https://coveralls.io/github/nielstron/pyblnet?branch=master)
31
31
 
@@ -49,12 +49,12 @@ Setting switches and reading their manual/auto state is only possible via the BL
49
49
  ### Usage
50
50
 
51
51
  ```python
52
- from pyblnet import test_blnet, BLNET, BLNETWeb, BLNETDirect
52
+ from pyblnet import blnet_test, BLNET, BLNETWeb, BLNETDirect
53
53
 
54
54
  ip = '192.168.178.10'
55
55
 
56
56
  # Check if there is a blnet at given address
57
- test_blnet(ip) # -> True/False
57
+ blnet_test(ip) # -> True/False
58
58
 
59
59
  # Convenient high level interface
60
60
  blnet = BLNET(ip, password='pass', timeout=5)
@@ -67,8 +67,6 @@ blnet.turn_off(10)
67
67
  # Fetch data (contains all available data using enabled interfaces)
68
68
  print(blnet.fetch())
69
69
 
70
-
71
-
72
70
  # The low level modules are also available
73
71
  # note that the direct use of these modules is discouraged though
74
72
 
@@ -94,4 +92,5 @@ print(blnet._get_data(1))
94
92
  ```
95
93
 
96
94
 
97
- [1] https://www.haus-terra.at/heizung/download/Schnittstelle/Schnittstelle_PC_Bootloader.pdf
95
+ [1] Technische Alternative, "Schnittstelle Winsol <> Bootloader" (2006), archived copy: http://web.archive.org/web/20160122124754/http://www.haus-terra.at:80/heizung/download/Schnittstelle/Schnittstelle_PC_Bootloader.pdf
96
+