PyBLNET 0.9.4__tar.gz → 0.9.5__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.9.4 → PyBLNET-0.9.5}/PKG-INFO +2 -4
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/PyBLNET.egg-info/PKG-INFO +2 -4
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/README.md +1 -1
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/__init__.py +1 -1
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/blnet_parser.py +12 -22
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_parser.py +8 -4
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/LICENSE.txt +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/PyBLNET.egg-info/SOURCES.txt +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/PyBLNET.egg-info/dependency_links.txt +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/PyBLNET.egg-info/requires.txt +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/PyBLNET.egg-info/top_level.txt +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/blnet.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/blnet_conn.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/blnet_web.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/__init__.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/580500.alternative.htm +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/580500.htm +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/580600.htm +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/__init__.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/blnet_mock_server.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/main.htm +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/main.html +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/par.htm +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_structure/server_control.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/test_web.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/web_raw/__init__.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/pyblnet/tests/web_raw/web_state.py +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/setup.cfg +0 -0
- {pyblnet-0.9.4 → PyBLNET-0.9.5}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyBLNET
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.5
|
|
4
4
|
Summary: Automate wireless communication to UVR1611 via BL-NET
|
|
5
5
|
Home-page: https://github.com/nielstron/pyblnet/
|
|
6
6
|
Author: nielstron
|
|
@@ -22,11 +22,9 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
22
22
|
Requires-Python: >=3
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.txt
|
|
25
|
-
Requires-Dist: htmldom
|
|
26
|
-
Requires-Dist: requests
|
|
27
25
|
|
|
28
26
|
# PyBLNET - a very basic python BL-NET bridge
|
|
29
|
-
[](https://github.com/nielstron/pyblnet/actions/workflows/build.yml)
|
|
30
28
|
[](https://coveralls.io/github/nielstron/pyblnet?branch=master)
|
|
31
29
|
|
|
32
30
|
A package that connects to the BL-NET that is connected itself to a UVR1611 device by Technische Alternative.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyBLNET
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.5
|
|
4
4
|
Summary: Automate wireless communication to UVR1611 via BL-NET
|
|
5
5
|
Home-page: https://github.com/nielstron/pyblnet/
|
|
6
6
|
Author: nielstron
|
|
@@ -22,11 +22,9 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
22
22
|
Requires-Python: >=3
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.txt
|
|
25
|
-
Requires-Dist: htmldom
|
|
26
|
-
Requires-Dist: requests
|
|
27
25
|
|
|
28
26
|
# PyBLNET - a very basic python BL-NET bridge
|
|
29
|
-
[](https://github.com/nielstron/pyblnet/actions/workflows/build.yml)
|
|
30
28
|
[](https://coveralls.io/github/nielstron/pyblnet?branch=master)
|
|
31
29
|
|
|
32
30
|
A package that connects to the BL-NET that is connected itself to a UVR1611 device by Technische Alternative.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# PyBLNET - a very basic python BL-NET bridge
|
|
2
|
-
[](https://github.com/nielstron/pyblnet/actions/workflows/build.yml)
|
|
3
3
|
[](https://coveralls.io/github/nielstron/pyblnet?branch=master)
|
|
4
4
|
|
|
5
5
|
A package that connects to the BL-NET that is connected itself to a UVR1611 device by Technische Alternative.
|
|
@@ -79,30 +79,18 @@ class BLNETParser:
|
|
|
79
79
|
self.digital[channel + 1] = self._convert_digital(digital, channel)
|
|
80
80
|
|
|
81
81
|
self.speed = {}
|
|
82
|
-
for
|
|
83
|
-
speed = self._convert_speed(
|
|
84
|
-
if speed:
|
|
85
|
-
self.speed[channel + 1] = round(speed, 3)
|
|
86
|
-
else:
|
|
87
|
-
break
|
|
82
|
+
for idx, value in enumerate(speed):
|
|
83
|
+
self.speed[idx + 1] = self._convert_speed(value)
|
|
88
84
|
|
|
89
85
|
self.energy = {}
|
|
90
86
|
for channel in range(0, 2):
|
|
91
87
|
energy = self._convert_energy(MWh[channel], kWh[channel], active, channel)
|
|
92
|
-
|
|
93
|
-
self.energy[channel + 1] = round(energy, 3)
|
|
94
|
-
else:
|
|
95
|
-
break
|
|
88
|
+
self.energy[channel + 1] = energy
|
|
96
89
|
|
|
97
90
|
self.power = {}
|
|
98
|
-
for
|
|
99
|
-
power = self._convert_power(
|
|
100
|
-
|
|
101
|
-
self.power[channel + 1] = round(
|
|
102
|
-
self._convert_power(power[channel], active, channel), 3
|
|
103
|
-
)
|
|
104
|
-
else:
|
|
105
|
-
break
|
|
91
|
+
for idx, value in enumerate(power):
|
|
92
|
+
power = self._convert_power(value, active, idx)
|
|
93
|
+
self.power[idx + 1] = power
|
|
106
94
|
|
|
107
95
|
def to_dict(self):
|
|
108
96
|
"""
|
|
@@ -149,7 +137,7 @@ class BLNETParser:
|
|
|
149
137
|
if value & SPEED_ACTIVE:
|
|
150
138
|
return None
|
|
151
139
|
else:
|
|
152
|
-
return value & SPEED_MASK
|
|
140
|
+
return round(value & SPEED_MASK, 3)
|
|
153
141
|
|
|
154
142
|
def _convert_energy(self, mwh, kwh, active, position):
|
|
155
143
|
"""
|
|
@@ -158,7 +146,7 @@ class BLNETParser:
|
|
|
158
146
|
"""
|
|
159
147
|
if active & position:
|
|
160
148
|
kwh = self._calculate_value(kwh, 0.1, INT16_POSITIVE_MASK)
|
|
161
|
-
return mwh * 1000 + kwh
|
|
149
|
+
return round(mwh * 1000 + kwh, 3)
|
|
162
150
|
else:
|
|
163
151
|
return None
|
|
164
152
|
|
|
@@ -168,12 +156,14 @@ class BLNETParser:
|
|
|
168
156
|
@return its power
|
|
169
157
|
"""
|
|
170
158
|
if active & position:
|
|
171
|
-
|
|
159
|
+
value = self._calculate_value(value, 1 / 2560, INT32_MASK, INT32_SIGN)
|
|
160
|
+
value = round(value, 3)
|
|
161
|
+
return value
|
|
172
162
|
else:
|
|
173
163
|
return None
|
|
174
164
|
|
|
175
165
|
def _calculate_value(
|
|
176
|
-
self, value, multiplier=1, positive_mask=POSITIVE_VALUE_MASK, signbit=SIGN_BIT
|
|
166
|
+
self, value, multiplier=1.0, positive_mask=POSITIVE_VALUE_MASK, signbit=SIGN_BIT
|
|
177
167
|
):
|
|
178
168
|
result = value & positive_mask
|
|
179
169
|
if value & signbit:
|
|
@@ -11,12 +11,16 @@ class TestParser(unittest.TestCase):
|
|
|
11
11
|
expected_values = {
|
|
12
12
|
'analog': {1: 12.5, 2: 69.3, 3: 61.4, 4: 51.5, 5: 38.2, 6: 65.4, 7: 27.8, 8: 22.4, 9: 25.5, 10: 24.3, 11: 24.8, 12: 0, 13: 31.7, 14: 1, 15: 0, 16: 48.2},
|
|
13
13
|
'digital': {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0},
|
|
14
|
-
'speed': {},
|
|
15
|
-
'energy': {},
|
|
16
|
-
'power': {}
|
|
14
|
+
'speed': {1: None, 2: 0, 3: 0, 4: 0},
|
|
15
|
+
'energy': {1: None, 2: None},
|
|
16
|
+
'power': {1: None, 2: None}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
assert parsed_values == expected_values
|
|
19
|
+
assert parsed_values['analog'] == expected_values['analog']
|
|
20
|
+
assert parsed_values['digital'] == expected_values['digital']
|
|
21
|
+
assert parsed_values['speed'] == expected_values['speed']
|
|
22
|
+
assert parsed_values['energy'] == expected_values['energy']
|
|
23
|
+
assert parsed_values['power'] == expected_values['power']
|
|
20
24
|
|
|
21
25
|
def test_parser_not_ok(self):
|
|
22
26
|
data = b'broken} \xb5"f"\x03"~!\x8e"\x16!\xe0 \xff \xf3 \xf8 \x00\x00=!\x01\x00\x00`\xe2!\x00\x00\x80\x00\x00\x00\x00,\x00\xa4(\x06\x00DhI\x82\x1d\x04Ce\xc0\x00'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|