PyBLNET 0.9.4__py3-none-any.whl → 0.10.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 +2 -8
- pyblnet/blnet_conn.py +8 -5
- pyblnet/blnet_parser.py +13 -23
- pyblnet/blnet_web.py +2 -2
- {PyBLNET-0.9.4.dist-info → pyblnet-0.10.0.dist-info}/METADATA +15 -18
- pyblnet-0.10.0.dist-info/RECORD +9 -0
- {PyBLNET-0.9.4.dist-info → pyblnet-0.10.0.dist-info}/WHEEL +1 -2
- PyBLNET-0.9.4.dist-info/RECORD +0 -24
- PyBLNET-0.9.4.dist-info/top_level.txt +0 -1
- pyblnet/tests/__init__.py +0 -0
- pyblnet/tests/test_parser.py +0 -24
- pyblnet/tests/test_structure/580500.alternative.htm +0 -0
- pyblnet/tests/test_structure/580500.htm +0 -1
- pyblnet/tests/test_structure/580600.htm +0 -0
- pyblnet/tests/test_structure/__init__.py +0 -0
- pyblnet/tests/test_structure/blnet_mock_server.py +0 -279
- pyblnet/tests/test_structure/main.htm +0 -63
- pyblnet/tests/test_structure/main.html +0 -63
- pyblnet/tests/test_structure/par.htm +0 -0
- pyblnet/tests/test_structure/server_control.py +0 -59
- pyblnet/tests/test_web.py +0 -204
- pyblnet/tests/web_raw/__init__.py +0 -0
- pyblnet/tests/web_raw/web_state.py +0 -151
- {PyBLNET-0.9.4.dist-info → pyblnet-0.10.0.dist-info/licenses}/LICENSE.txt +0 -0
pyblnet/__init__.py
CHANGED
|
@@ -4,17 +4,11 @@
|
|
|
4
4
|
import warnings
|
|
5
5
|
|
|
6
6
|
try:
|
|
7
|
-
from .blnet_web import BLNETWeb,
|
|
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,
|
|
13
|
+
VERSION = (0, 10, 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_conn.py
CHANGED
|
@@ -9,7 +9,7 @@ https://github.com/berwinter/uvr1611/blob/master/lib/backend/blnet-connection.in
|
|
|
9
9
|
@author: Niels
|
|
10
10
|
"""
|
|
11
11
|
from builtins import str, int
|
|
12
|
-
from socket import socket, getaddrinfo, SOCK_STREAM, IPPROTO_TCP
|
|
12
|
+
from socket import socket, getaddrinfo, SOCK_STREAM, IPPROTO_TCP, setdefaulttimeout
|
|
13
13
|
import struct
|
|
14
14
|
from time import sleep
|
|
15
15
|
from datetime import datetime
|
|
@@ -41,12 +41,13 @@ class BLNETDirect(object):
|
|
|
41
41
|
www.haus-terra.at/heizung/download/Schnittstelle/Schnittstelle_PC_Bootloader.pdf
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
|
-
def __init__(self, address, port=40000, reset=False):
|
|
44
|
+
def __init__(self, address, port: int = 40000, reset: bool = False, timeout: float = 60):
|
|
45
45
|
"""
|
|
46
46
|
Constructor
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
50
|
+
:param timeout: float, timeout in seconds for the connection
|
|
50
51
|
"""
|
|
51
52
|
assert isinstance(address, str)
|
|
52
53
|
assert isinstance(port, int)
|
|
@@ -58,6 +59,8 @@ class BLNETDirect(object):
|
|
|
58
59
|
self._socket = None
|
|
59
60
|
self._count = None
|
|
60
61
|
self._check_mode()
|
|
62
|
+
if timeout:
|
|
63
|
+
setdefaulttimeout(timeout)
|
|
61
64
|
|
|
62
65
|
def get_count(self):
|
|
63
66
|
"""
|
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
|
|
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
|
|
@@ -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:
|
pyblnet/blnet_web.py
CHANGED
|
@@ -16,7 +16,7 @@ import re
|
|
|
16
16
|
from builtins import int
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def blnet_test(ip, timeout=5, id=0):
|
|
20
20
|
"""
|
|
21
21
|
Tests whether an BLNET answers under given ip
|
|
22
22
|
Attributes:
|
|
@@ -63,7 +63,7 @@ class BLNETWeb(object):
|
|
|
63
63
|
assert timeout is None or isinstance(timeout, int)
|
|
64
64
|
if not ip.startswith("http://") and not ip.startswith("https://"):
|
|
65
65
|
ip = "http://" + ip
|
|
66
|
-
if not
|
|
66
|
+
if not blnet_test(ip):
|
|
67
67
|
raise ValueError("No BLNET found under given address: {}".format(ip))
|
|
68
68
|
self.ip = ip
|
|
69
69
|
self.password = password
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PyBLNET
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: Automate wireless communication to UVR1611 via BL-NET
|
|
5
|
-
|
|
6
|
-
Author: nielstron
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
19
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
19
|
License-File: LICENSE.txt
|
|
25
20
|
Requires-Dist: htmldom
|
|
26
21
|
Requires-Dist: requests
|
|
22
|
+
Requires-Dist: pytest ; extra == "test"
|
|
23
|
+
Project-URL: Homepage, https://github.com/nielstron/pyblnet/
|
|
24
|
+
Provides-Extra: test
|
|
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.
|
|
@@ -49,12 +47,12 @@ Setting switches and reading their manual/auto state is only possible via the BL
|
|
|
49
47
|
### Usage
|
|
50
48
|
|
|
51
49
|
```python
|
|
52
|
-
from pyblnet import
|
|
50
|
+
from pyblnet import blnet_test, BLNET, BLNETWeb, BLNETDirect
|
|
53
51
|
|
|
54
52
|
ip = '192.168.178.10'
|
|
55
53
|
|
|
56
54
|
# Check if there is a blnet at given address
|
|
57
|
-
|
|
55
|
+
blnet_test(ip) # -> True/False
|
|
58
56
|
|
|
59
57
|
# Convenient high level interface
|
|
60
58
|
blnet = BLNET(ip, password='pass', timeout=5)
|
|
@@ -67,8 +65,6 @@ blnet.turn_off(10)
|
|
|
67
65
|
# Fetch data (contains all available data using enabled interfaces)
|
|
68
66
|
print(blnet.fetch())
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
68
|
# The low level modules are also available
|
|
73
69
|
# note that the direct use of these modules is discouraged though
|
|
74
70
|
|
|
@@ -95,3 +91,4 @@ print(blnet._get_data(1))
|
|
|
95
91
|
|
|
96
92
|
|
|
97
93
|
[1] https://www.haus-terra.at/heizung/download/Schnittstelle/Schnittstelle_PC_Bootloader.pdf
|
|
94
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
pyblnet/__init__.py,sha256=7m5_JVwdmIuHck6GTDQl8I0sg2Dp_rL_oZRzwx-f7QQ,270
|
|
2
|
+
pyblnet/blnet.py,sha256=t4NKLZib_kV-S8ZEnNim8ML52gE99nrWzlt_GZCjxC4,7570
|
|
3
|
+
pyblnet/blnet_conn.py,sha256=d02182Zc_K4WVLqchlRL2n4yvzei3p4ig-SdS_RIxuI,12795
|
|
4
|
+
pyblnet/blnet_parser.py,sha256=B5C-unY9kaw3S661r0IPjnZ_XIOP38Ux0rN5kI9eZhI,4922
|
|
5
|
+
pyblnet/blnet_web.py,sha256=yuC6uef_DaLyVNrar-_0bnj-VIk_AIoFnsABueXmqaY,11776
|
|
6
|
+
pyblnet-0.10.0.dist-info/licenses/LICENSE.txt,sha256=qLriK0Yi_eGmEwdftMY0hOmBLuYbPHMXDqzc7GZCAps,1077
|
|
7
|
+
pyblnet-0.10.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
8
|
+
pyblnet-0.10.0.dist-info/METADATA,sha256=GYjbdS9NrNWrvWRP8WPmR-gtqkIfy2sfjIo7o0tUhUk,3837
|
|
9
|
+
pyblnet-0.10.0.dist-info/RECORD,,
|
PyBLNET-0.9.4.dist-info/RECORD
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
pyblnet/__init__.py,sha256=mrQFIL48ZfLgZXghJWisLX8o4PMUiPC6lDzbNlWSx1g,499
|
|
2
|
-
pyblnet/blnet.py,sha256=t4NKLZib_kV-S8ZEnNim8ML52gE99nrWzlt_GZCjxC4,7570
|
|
3
|
-
pyblnet/blnet_conn.py,sha256=6ji91hnm7X5W6v6rHAMNYmwOjTPtyeSxAriYwQdcWks,12612
|
|
4
|
-
pyblnet/blnet_parser.py,sha256=b8NLSAbxnCYZ5uUIDTeMuwA1LrsiiPdyXOSDzafK0oE,5195
|
|
5
|
-
pyblnet/blnet_web.py,sha256=1fQ8PRkv2RW6ikdTUm7s_eSFDK_pp5MQenJWhzB-n5k,11776
|
|
6
|
-
pyblnet/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
pyblnet/tests/test_parser.py,sha256=sVy3pR-G0ZE9pOhnFxurce_Ygzjh6zaZebhA504KDlI,1115
|
|
8
|
-
pyblnet/tests/test_web.py,sha256=8ypDQhkgzR2PDg0lYaRwFYDlk1x3niJY7xOTk6KZCmM,7039
|
|
9
|
-
pyblnet/tests/test_structure/580500.alternative.htm,sha256=yN1OE4EJDpTk-vAFjI-OXYYSJIWRIikiQLRsf8rF3LQ,6968
|
|
10
|
-
pyblnet/tests/test_structure/580500.htm,sha256=T1xwHQlvqZBEG72HX7trw4f-UaiO9zY9f1-mNbDAx9I,6992
|
|
11
|
-
pyblnet/tests/test_structure/580600.htm,sha256=MxVwje142sbAYzP7ia_GAN8xqjz5nc67Xzj07JdyaKA,8421
|
|
12
|
-
pyblnet/tests/test_structure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
pyblnet/tests/test_structure/blnet_mock_server.py,sha256=V_1lGOPnXG5d1LoFzuFCaxQuiGVUl20Bkov52u_L3eA,9868
|
|
14
|
-
pyblnet/tests/test_structure/main.htm,sha256=X2BFWvZlJhvQXCPTHbagp7YDFeqxJhDH01xTXk6e9VE,5600
|
|
15
|
-
pyblnet/tests/test_structure/main.html,sha256=X2BFWvZlJhvQXCPTHbagp7YDFeqxJhDH01xTXk6e9VE,5600
|
|
16
|
-
pyblnet/tests/test_structure/par.htm,sha256=i-VuEEaeAuEy6JmHEZVJIyNisOFBT6s6LLF5uT_A3-I,8756
|
|
17
|
-
pyblnet/tests/test_structure/server_control.py,sha256=4lvHzqph-8steCaOJlOwdbz4X7mS6LIwXNoGyc8Uh-0,1650
|
|
18
|
-
pyblnet/tests/web_raw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
pyblnet/tests/web_raw/web_state.py,sha256=RQdSu8S6LsEg8kkqpLVnhOv_tL0Pn8c2MCb8qXT2Dxk,5234
|
|
20
|
-
PyBLNET-0.9.4.dist-info/LICENSE.txt,sha256=qLriK0Yi_eGmEwdftMY0hOmBLuYbPHMXDqzc7GZCAps,1077
|
|
21
|
-
PyBLNET-0.9.4.dist-info/METADATA,sha256=DGBMx5cFky_-9vuzc0O7dtX7G9l98QHQlgwGikQALfs,3850
|
|
22
|
-
PyBLNET-0.9.4.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
23
|
-
PyBLNET-0.9.4.dist-info/top_level.txt,sha256=kgkmudEmlKVRznWy4MId7Gz3z075jYSz3Z88Vc6oGm0,8
|
|
24
|
-
PyBLNET-0.9.4.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
pyblnet
|
pyblnet/tests/__init__.py
DELETED
|
File without changes
|
pyblnet/tests/test_parser.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
from pyblnet.blnet_parser import BLNETParser
|
|
2
|
-
import unittest
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class TestParser(unittest.TestCase):
|
|
6
|
-
|
|
7
|
-
def test_parser_ok(self):
|
|
8
|
-
data = b'} \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'
|
|
9
|
-
parser = BLNETParser(data)
|
|
10
|
-
parsed_values = parser.to_dict()
|
|
11
|
-
expected_values = {
|
|
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
|
-
'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': {}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
assert parsed_values == expected_values
|
|
20
|
-
|
|
21
|
-
def test_parser_not_ok(self):
|
|
22
|
-
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'
|
|
23
|
-
with self.assertRaises(ValueError):
|
|
24
|
-
parser = BLNETParser(data)
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta http-equiv="expires" content="0"> <title>UVR1611 / Knoten 1</title> <style type="text/css"> body{background-color:#000000;font-family:"Courier New", Courier, monospace; margin:0px;} #left{background-color:#DDDDDD;position:absolute;left:0px;top:30px;bottom:20px;width:160px;padding:5px;}#head{background-color:#0000FF;color:#FFFF00;font-weight:bold;font-size:large;text-align:center;position:absolute;left:0px;top:0px;height:30px;right:0px;}#footer{background-color:#FFFF00;color:#000000;text-align:center;position:absolute;left:0px;bottom:0px;height:20px;right:0px;}#center{position:absolute;left:170px;top:30px;bottom:20px;right:0px;} .c{margin:15px auto;text-align:left; width:430px;}.ze{background-color:#CCCCCC;width:100%; border-color:#FFFFFF;border-style:solid;border-width:thin;padding:3px;}.cen{text-align:center;width:100%;} .cen1{height:100%;position:absolute;min-height:600px;}.ueber{position:relative;height:100%;width:100%;max-width:800px;margin:auto;text-align:left;} ul#nav {width: 160px;margin: 0;padding: 0px;} ul#nav li {list-style: none;margin: 0px; padding: 0;} ul#nav a, .ll a {display:block;padding: 3px;text-decoration: none;font-weight: bold;color: #0000CC; background-color: #cccccc;border: 1px solid black;border-left-color: white; border-top-color: white;} ul#nav a:hover, .ll a:hover {border-color: white;border-left-color: black; border-top-color: black;color: white; background-color: #999999;}.ull{position:relative;left:-30px;width:140px; font-size:12px;} .b{font-weight:bold;text-decoration:none;}.bo{border-bottom:medium #FFFFFF solid;}.bs{border-bottom:thin #FFFFFF solid;}.pf a{text-decoration:none;color:#007755;}.gsm{width:15px;height:25px;bottom:0px;font-size:0px;position:absolute;}.dfk{color:#0000ff;}.ea td{vertical-align:top;} .r{color:#FF0000;}.g{color:#00FF00;}.bgb{background-color:#0000CC;color:#FFFF00;} .men {} ul#nav li ul {display: none;}ul#nav li:hover ul {display: block;} #if{position:absolute;width:100%;height:100%;border:none;}.rp{text-decoration:none; color:#007755;} .bf{color:#FFFFFF; background-color:#000000; padding: 0 0px}.nul{text-decoration: none; color:#000000;} </style><script type="text/javascript">function getHttpRequest(id){var xmlhttp = null;if (window.XMLHttpRequest)xmlhttp = new XMLHttpRequest();else if (window.ActiveXObject) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");xmlhttp.open("GET", "par.htm?blp="+id+"&123"+parseInt(Math.random()*9999), true);xmlhttp.onreadystatechange = function(){if(xmlhttp.readyState != 4)$(id).innerHTML = \'⌛\'; if(xmlhttp.readyState == 4 && xmlhttp.status == 200)$(id).innerHTML = xmlhttp.responseText; };xmlhttp.send(null);}function $(id) {return document.getElementById(id);}</script>\x00</head><body><form name="blw" method="GET"><div class="cen"><div class="c"><div class="ze cen bgb"> <span class="r b">1 </span><span class="g b">2 </span><span class="r b">3 </span><span class="r b">4 </span><span class="r b">5 </span><span class="r b">6 </span><span class="r b">7 </span><span class="r b">☚10 </span><br><span class="men">EINGAENGE<br></span> </div><div class="ze cen"><div class="c" style="width:21em;"> 1: TKollektor<br> 5,3 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C01.htm\'"><=</button></span><br> 2: TSP.oben<br> 46,3 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C02.htm\'"><=</button></span><br> 3: TSP.unten<br> 53,1 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C03.htm\'"><=</button></span><br> 4: THeizkr.VL<br> 44,8 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C04.htm\'"><=</button></span><br> 5: Temp.Aussen<br> - 72,3 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C05.htm\'"><=</button></span><br> 6: Temp.Raum<br> 24,6 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C06.htm\'"><=</button></span><br> 7: T Kaminofen<br> 20,9 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C07.htm\'"><=</button></span><br> 8: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C08.htm\'"><=</button></span><br> 9: TZirku.RL<br> 36,6 °C PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C09.htm\'"><=</button></span><br>10: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C0A.htm\'"><=</button></span><br>11: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C0B.htm\'"><=</button></span><br>12: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C0C.htm\'"><=</button></span><br>13: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C0D.htm\'"><=</button></span><br>14: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C0E.htm\'"><=</button></span><br>15: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C0F.htm\'"><=</button></span><br>16: -----<br> unbenutzt PAR?<span class="pf"><button type="button" onclick="document.location.href=\'580C10.htm\'"><=</button></span></div></div><div class="ze cen"><div class="c" style="width:370px"> <span class="ll" style="width:150px; display:inline-block; text-align:center;" ><a href="580500.htm" target="centerframe">aktualisieren</a></span><span class="ll" style="width:100px; display:inline-block; text-align:center;"> <a href="580000.htm" target="centerframe">MENÜ</a></span><span style="width:100px; display:inline-block;text-align:center;" class="ll"> <a href="javascript:history.back()" target="centerframe">zurück</a></span><br><br> </div></div></div></div></form></body></html>
|
|
Binary file
|
|
File without changes
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import urllib.parse
|
|
3
|
-
from http.server import SimpleHTTPRequestHandler, HTTPServer
|
|
4
|
-
|
|
5
|
-
try:
|
|
6
|
-
from http import HTTPStatus
|
|
7
|
-
except ImportError:
|
|
8
|
-
# Backwards compatability
|
|
9
|
-
import http.client as HTTPStatus
|
|
10
|
-
import re
|
|
11
|
-
import posixpath
|
|
12
|
-
from pathlib import Path
|
|
13
|
-
|
|
14
|
-
SERVER_DIR = Path(__file__).parent or Path(".")
|
|
15
|
-
PASSWORD = "0123"
|
|
16
|
-
|
|
17
|
-
COOKIE_RANGE = (0xAAAA, 0xFFFF)
|
|
18
|
-
COOKIE_NUM = COOKIE_RANGE[1] - COOKIE_RANGE[0]
|
|
19
|
-
LOGIN_COOKIES = [hex(i) for i in range(*COOKIE_RANGE)]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class BLNETServer(HTTPServer):
|
|
23
|
-
|
|
24
|
-
current_log_in_cookie = 0
|
|
25
|
-
|
|
26
|
-
# Currently allowed login cookie
|
|
27
|
-
# or none if no one logged in
|
|
28
|
-
logged_in = None
|
|
29
|
-
# no login necessary
|
|
30
|
-
password = None
|
|
31
|
-
# access to digital nodes
|
|
32
|
-
nodes = {}
|
|
33
|
-
# Enable option to block server
|
|
34
|
-
# (sends access denied all the time, for whatever reason)
|
|
35
|
-
blocked = False
|
|
36
|
-
|
|
37
|
-
def set_password(self, password):
|
|
38
|
-
self.password = password
|
|
39
|
-
self.logged_in = None
|
|
40
|
-
|
|
41
|
-
def log_in(self):
|
|
42
|
-
if self.logged_in is not None:
|
|
43
|
-
return False
|
|
44
|
-
self.logged_in = LOGIN_COOKIES[self.current_log_in_cookie]
|
|
45
|
-
self.current_log_in_cookie += 1
|
|
46
|
-
self.current_log_in_cookie %= COOKIE_NUM
|
|
47
|
-
return self.logged_in
|
|
48
|
-
|
|
49
|
-
def log_out(self):
|
|
50
|
-
self.logged_in = None
|
|
51
|
-
|
|
52
|
-
def is_logged_in(self, cookie):
|
|
53
|
-
return cookie is not None and self.logged_in == cookie
|
|
54
|
-
|
|
55
|
-
def set_node(self, id, value):
|
|
56
|
-
self.nodes[id] = value
|
|
57
|
-
|
|
58
|
-
def get_node(self, id):
|
|
59
|
-
return self.nodes.get(id)
|
|
60
|
-
|
|
61
|
-
def set_blocked(self):
|
|
62
|
-
self.blocked = True
|
|
63
|
-
|
|
64
|
-
def unset_blocked(self):
|
|
65
|
-
self.blocked = False
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class BLNETRequestHandler(SimpleHTTPRequestHandler):
|
|
69
|
-
|
|
70
|
-
# uncomment on higher python versions for better debugging
|
|
71
|
-
# server: BLNETServer
|
|
72
|
-
|
|
73
|
-
def do_GET(self):
|
|
74
|
-
"""
|
|
75
|
-
Handle get request, but check for errors in protocol
|
|
76
|
-
:return:
|
|
77
|
-
"""
|
|
78
|
-
if self.server.blocked:
|
|
79
|
-
self.send_error(403, "Access denied because server is blocked")
|
|
80
|
-
return
|
|
81
|
-
path = self.translate_path(self.path)
|
|
82
|
-
if (
|
|
83
|
-
self.server.is_logged_in(self.headers.get("cookie"))
|
|
84
|
-
and "?blL=1" in self.requestline
|
|
85
|
-
):
|
|
86
|
-
self.server.log_out()
|
|
87
|
-
# Only access that is allowed without login is main.html
|
|
88
|
-
if (
|
|
89
|
-
not Path(path) == SERVER_DIR
|
|
90
|
-
and not Path(path) == SERVER_DIR.joinpath("main.htm")
|
|
91
|
-
and not Path(path) == SERVER_DIR.joinpath("main.html")
|
|
92
|
-
):
|
|
93
|
-
if not self.server.is_logged_in(self.headers.get("cookie")):
|
|
94
|
-
self.send_error(403, "Not logged in, access denied")
|
|
95
|
-
return
|
|
96
|
-
# Parse node sets
|
|
97
|
-
node_reg = re.compile(
|
|
98
|
-
r"[?&]blw91A1200(?P<node>[0-9a-fA-F])=(?P<value>[1-3])"
|
|
99
|
-
)
|
|
100
|
-
for match in node_reg.finditer(self.path):
|
|
101
|
-
self.server.set_node(match.group("node"), match.group("value"))
|
|
102
|
-
|
|
103
|
-
# print(path)
|
|
104
|
-
super().do_GET()
|
|
105
|
-
|
|
106
|
-
def do_POST(self):
|
|
107
|
-
if self.server.blocked:
|
|
108
|
-
# apparently login may still may possible, access may be denied anyway
|
|
109
|
-
pass
|
|
110
|
-
# Result of self.rfile.read() if correct POST request:
|
|
111
|
-
# b'blu=1&blp=0123&bll=Login'
|
|
112
|
-
perfect = b"blu=1&blp=0123&bll=Login"
|
|
113
|
-
request_raw = self.rfile.read(len(perfect))
|
|
114
|
-
request_string = request_raw.decode(encoding="utf-8")
|
|
115
|
-
request_data = request_string.split("&")
|
|
116
|
-
|
|
117
|
-
blu = False
|
|
118
|
-
blp = False
|
|
119
|
-
bll = False
|
|
120
|
-
for query in request_data:
|
|
121
|
-
if query.startswith("blu"):
|
|
122
|
-
if query.split("=")[1] != "1":
|
|
123
|
-
self.send_error(
|
|
124
|
-
403, "Wrong user set: expected blu=1, got {}".format(query)
|
|
125
|
-
)
|
|
126
|
-
return
|
|
127
|
-
blu = True
|
|
128
|
-
elif query.startswith("blp"):
|
|
129
|
-
if query.split("=")[1] != self.server.password:
|
|
130
|
-
self.send_error(
|
|
131
|
-
403,
|
|
132
|
-
"Wrong password: expected blp={}, got {}".format(
|
|
133
|
-
self.server.password, query
|
|
134
|
-
),
|
|
135
|
-
)
|
|
136
|
-
return
|
|
137
|
-
blp = True
|
|
138
|
-
elif query.startswith("bll"):
|
|
139
|
-
if query.split("=")[1] != "Login":
|
|
140
|
-
self.send_error(
|
|
141
|
-
403,
|
|
142
|
-
"Wrong bll spec, expected bll=Login, got {}".format(
|
|
143
|
-
request_string
|
|
144
|
-
),
|
|
145
|
-
)
|
|
146
|
-
return
|
|
147
|
-
bll = True
|
|
148
|
-
if not (blu and blp and bll):
|
|
149
|
-
self.send_error(403, "Missing query param in {}".format(request_string))
|
|
150
|
-
return
|
|
151
|
-
# Check for content type
|
|
152
|
-
if not self.headers.get("Content-Type") == "application/x-www-form-urlencoded":
|
|
153
|
-
self.send_error(403, "Wrong content-type")
|
|
154
|
-
return
|
|
155
|
-
# All checks passed? set Set-Cookie header and do_GET
|
|
156
|
-
# random cookie - do not hardcode
|
|
157
|
-
cookie = self.server.log_in()
|
|
158
|
-
if not cookie:
|
|
159
|
-
self.send_error(403, "Previous user did not log out")
|
|
160
|
-
return
|
|
161
|
-
self.headers.add_header("Cookie", cookie)
|
|
162
|
-
self.do_GET()
|
|
163
|
-
|
|
164
|
-
def translate_path(self, path):
|
|
165
|
-
"""Translate a /-separated PATH to the local filename syntax.
|
|
166
|
-
|
|
167
|
-
Components that mean special things to the local file system
|
|
168
|
-
(e.g. drive or directory names) are ignored. (XXX They should
|
|
169
|
-
probably be diagnosed.)
|
|
170
|
-
|
|
171
|
-
only slightly changed method of the standard library
|
|
172
|
-
"""
|
|
173
|
-
# abandon query parameters
|
|
174
|
-
path = path.split("?", 1)[0]
|
|
175
|
-
path = path.split("#", 1)[0]
|
|
176
|
-
# Don't forget explicit trailing slash when normalizing. Issue17324
|
|
177
|
-
trailing_slash = path.rstrip().endswith("/")
|
|
178
|
-
try:
|
|
179
|
-
path = urllib.parse.unquote(path, errors="surrogatepass")
|
|
180
|
-
except UnicodeDecodeError:
|
|
181
|
-
path = urllib.parse.unquote(path)
|
|
182
|
-
path = posixpath.normpath(path)
|
|
183
|
-
words = path.split("/")
|
|
184
|
-
words = filter(None, words)
|
|
185
|
-
path = str(SERVER_DIR.absolute())
|
|
186
|
-
for word in words:
|
|
187
|
-
if os.path.dirname(word) or word in (os.curdir, os.pardir):
|
|
188
|
-
# Ignore components that are not a simple file/directory name
|
|
189
|
-
continue
|
|
190
|
-
path = os.path.join(path, word)
|
|
191
|
-
if trailing_slash:
|
|
192
|
-
path += "/"
|
|
193
|
-
return path
|
|
194
|
-
|
|
195
|
-
def send_head(self):
|
|
196
|
-
"""Common code for GET and HEAD commands.
|
|
197
|
-
|
|
198
|
-
This sends the response code and MIME headers.
|
|
199
|
-
|
|
200
|
-
Return value is either a file object (which has to be copied
|
|
201
|
-
to the outputfile by the caller unless the command was HEAD,
|
|
202
|
-
and must be closed by the caller under all circumstances), or
|
|
203
|
-
None, in which case the caller has nothing further to do.
|
|
204
|
-
|
|
205
|
-
only slightly changed method of the standard library
|
|
206
|
-
"""
|
|
207
|
-
path = self.translate_path(self.path)
|
|
208
|
-
f = None
|
|
209
|
-
if os.path.isdir(path):
|
|
210
|
-
parts = urllib.parse.urlsplit(self.path)
|
|
211
|
-
if not parts.path.endswith("/"):
|
|
212
|
-
# redirect browser - doing basically what apache does
|
|
213
|
-
self.send_response(HTTPStatus.MOVED_PERMANENTLY)
|
|
214
|
-
new_parts = (parts[0], parts[1], parts[2] + "/", parts[3], parts[4])
|
|
215
|
-
new_url = urllib.parse.urlunsplit(new_parts)
|
|
216
|
-
self.send_header("Location", new_url)
|
|
217
|
-
self.end_headers()
|
|
218
|
-
return None
|
|
219
|
-
# BLNET has main.html/main.htm
|
|
220
|
-
for index in "main.html", "main.htm":
|
|
221
|
-
index = os.path.join(path, index)
|
|
222
|
-
if os.path.exists(index):
|
|
223
|
-
path = index
|
|
224
|
-
break
|
|
225
|
-
else:
|
|
226
|
-
return self.list_directory(path)
|
|
227
|
-
ctype = self.guess_type(path)
|
|
228
|
-
try:
|
|
229
|
-
f = open(path, "rb")
|
|
230
|
-
except OSError:
|
|
231
|
-
self.send_error(HTTPStatus.NOT_FOUND, "File not found")
|
|
232
|
-
return None
|
|
233
|
-
try:
|
|
234
|
-
self.send_response(HTTPStatus.OK)
|
|
235
|
-
self.send_header("Content-type", ctype)
|
|
236
|
-
fs = os.fstat(f.fileno())
|
|
237
|
-
self.send_header("Content-Length", str(fs[6]))
|
|
238
|
-
self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
|
|
239
|
-
# Addition: send cookie
|
|
240
|
-
if self.server.is_logged_in(self.headers.get("Cookie")):
|
|
241
|
-
self.send_header("Set-Cookie", self.server.logged_in)
|
|
242
|
-
self.end_headers()
|
|
243
|
-
return f
|
|
244
|
-
except:
|
|
245
|
-
f.close()
|
|
246
|
-
raise
|
|
247
|
-
|
|
248
|
-
def send_error(self, code, message=None, explain=None):
|
|
249
|
-
"""
|
|
250
|
-
Send blnet zugang verweigert page
|
|
251
|
-
:param code:
|
|
252
|
-
:param message:
|
|
253
|
-
:param explain:
|
|
254
|
-
:return:
|
|
255
|
-
"""
|
|
256
|
-
self.log_error("code %d, message %s", code, message)
|
|
257
|
-
self.send_response(code, message)
|
|
258
|
-
self.send_header("Connection", "close")
|
|
259
|
-
|
|
260
|
-
# Message body is omitted for cases described in:
|
|
261
|
-
# - RFC7230: 3.3. 1xx, 204(No Content), 304(Not Modified)
|
|
262
|
-
# - RFC7231: 6.3.6. 205(Reset Content)
|
|
263
|
-
body = None
|
|
264
|
-
if code >= 200 and code not in (
|
|
265
|
-
HTTPStatus.NO_CONTENT,
|
|
266
|
-
HTTPStatus.RESET_CONTENT,
|
|
267
|
-
HTTPStatus.NOT_MODIFIED,
|
|
268
|
-
):
|
|
269
|
-
# HTML encode to prevent Cross Site Scripting attacks
|
|
270
|
-
# (see bug #1100201)
|
|
271
|
-
# Specialized error method for BLNET
|
|
272
|
-
with SERVER_DIR.joinpath(".error.html").open("rb") as file:
|
|
273
|
-
body = file.read()
|
|
274
|
-
self.send_header("Content-Type", self.error_content_type)
|
|
275
|
-
self.send_header("Content-Length", int(len(body)))
|
|
276
|
-
self.end_headers()
|
|
277
|
-
|
|
278
|
-
if self.command != "HEAD" and body:
|
|
279
|
-
self.wfile.write(body)
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
4
|
-
<head>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
6
|
-
<title>Bl-Net</title>
|
|
7
|
-
<style type="text/css">
|
|
8
|
-
body{background-color:#000000;font-family:"Courier New", Courier, monospace; margin:0px;} #left{background-color:#DDDDDD;position:absolute;left:0px;top:30px;bottom:20px;width:160px;padding:5px;}#head{background-color:#0000FF;color:#FFFF00;font-weight:bold;font-size:large;text-align:center;position:absolute;left:0px;top:0px;height:30px;right:0px;}#footer{background-color:#FFFF00;color:#000000;text-align:center;position:absolute;left:0px;bottom:0px;height:20px;right:0px;}#center{position:absolute;left:170px;top:30px;bottom:20px;right:0px;} .c{margin:15px auto;text-align:left; width:430px;}.ze{background-color:#CCCCCC;width:100%; border-color:#FFFFFF;border-style:solid;border-width:thin;padding:3px;}.cen{text-align:center;width:100%;} .cen1{height:100%;position:absolute;min-height:600px;}.ueber{position:relative;height:100%;width:100%;max-width:800px;margin:auto;text-align:left;} ul#nav {width: 160px;margin: 0;padding: 0px;} ul#nav li {list-style: none;margin: 0px; padding: 0;} ul#nav a, .ll a {display:block;padding: 3px;text-decoration: none;font-weight: bold;color: #0000CC; background-color: #cccccc;border: 1px solid black;border-left-color: white; border-top-color: white;} ul#nav a:hover, .ll a:hover {border-color: white;border-left-color: black; border-top-color: black;color: white; background-color: #999999;}.ull{position:relative;left:-30px;width:140px; font-size:12px;} .b{font-weight:bold;text-decoration:none;}.bo{border-bottom:medium #FFFFFF solid;}.bs{border-bottom:thin #FFFFFF solid;}.pf a{text-decoration:none;color:#007755;}.gsm{width:15px;height:25px;bottom:0px;font-size:0px;position:absolute;}.dfk{color:#0000ff;}.ea td{vertical-align:top;} .r{color:#FF0000;}.g{color:#00FF00;}.bgb{background-color:#0000CC;color:#FFFF00;} .men {} ul#nav li ul {display: none;}ul#nav li:hover ul {display: block;} #if{position:absolute;width:100%;height:100%;border:none;}.rp{text-decoration:none; color:#007755;} .bf{color:#FFFFFF; background-color:#000000; padding: 0 0px}.nul{text-decoration: none; color:#000000;}
|
|
9
|
-
</style>
|
|
10
|
-
<script type="text/javascript">
|
|
11
|
-
var login=false; function sett() {t=window.frames.centerframe.document.title;document.getElementById('head').firstChild.nodeValue=t;document.title=t;} function act(aid){document.getElementById(aid).style.display="block";}function deact(did){document.getElementById(did).style.display="none";}
|
|
12
|
-
</script>
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<div class="cen cen1" style="background-color:#FFFFFF;">
|
|
16
|
-
<div class="ueber">
|
|
17
|
-
<div id="head">BL-NET</div>
|
|
18
|
-
<div id="left">
|
|
19
|
-
<ul id="nav">
|
|
20
|
-
<li><a href="can.htm" target="centerframe" onClick="act('bus');">CAN-Bus</a>
|
|
21
|
-
<ul id="bus" class="ull">
|
|
22
|
-
<li><a href="a_ein.htm?blaE=1" target="centerframe" onClick="act('bus');">analoge
|
|
23
|
-
Eingänge</a></li>
|
|
24
|
-
<li><a href="d_ein.htm?blaE=1" target="centerframe" onClick="act('bus');">digitale
|
|
25
|
-
Eingänge</a></li>
|
|
26
|
-
<br></ul>
|
|
27
|
-
</li>
|
|
28
|
-
<li><a href="GRAFIK.htm" target="_self">Schema</a></li>
|
|
29
|
-
<li><a href="gsm.htm" target="centerframe" onClick="deact('bus');">GSM</a></li>
|
|
30
|
-
<li><a href="ether.htm" target="centerframe" onClick="deact('bus');">Ethernet</a></li>
|
|
31
|
-
<li><a href="passw.htm" target="centerframe" onClick="deact('bus');">Passwörter</a></li>
|
|
32
|
-
<li><a href="data.htm" target="centerframe" onClick="deact('bus');">Datenverwaltung</a></li>
|
|
33
|
-
<li><a href="datalog.htm" target="centerframe" onClick="deact('bus');">Datenlogging</a></li>
|
|
34
|
-
</ul>
|
|
35
|
-
<br>
|
|
36
|
-
<div class="cen ll"><a href="#" id='ind'
|
|
37
|
-
onclick="if(login){deact('login');login=false;}else { act('login'); login=true;}"
|
|
38
|
-
class="b">Login</a> <a id='outd' style='display:none;' href="main.html?blL=1"
|
|
39
|
-
class="b">Logout</a>
|
|
40
|
-
<div><br>
|
|
41
|
-
<div id='logu'><b></div>
|
|
42
|
-
</b></div>
|
|
43
|
-
</div>
|
|
44
|
-
<br>
|
|
45
|
-
<div style="display:none;" id="login">
|
|
46
|
-
<form method="post" action="main.html">
|
|
47
|
-
<div><input name="blu" type="radio" value="1"/>Experte<br/><input name="u" type="radio" value="2"/>Anwender<br/>
|
|
48
|
-
<input name="blu" type="radio" value="5"/>nur ansehen<br/></div>
|
|
49
|
-
Passwort:<br/><input name="blp" type="password" size="10" maxlength="8"/><br/> <input name="bll"
|
|
50
|
-
type="submit"
|
|
51
|
-
value="Login"/>
|
|
52
|
-
</form>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<div id="center">
|
|
56
|
-
<iframe id="if" name="centerframe" src="begr.htm" onload="sett();"></iframe>
|
|
57
|
-
</div>
|
|
58
|
-
<div id="footer">Bootloader-NET V2.19 DE © 2011 <a href="http://www.ta.co.at/" target="_blank">TA</a>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</body>
|
|
63
|
-
</html>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
4
|
-
<head>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
6
|
-
<title>Bl-Net</title>
|
|
7
|
-
<style type="text/css">
|
|
8
|
-
body{background-color:#000000;font-family:"Courier New", Courier, monospace; margin:0px;} #left{background-color:#DDDDDD;position:absolute;left:0px;top:30px;bottom:20px;width:160px;padding:5px;}#head{background-color:#0000FF;color:#FFFF00;font-weight:bold;font-size:large;text-align:center;position:absolute;left:0px;top:0px;height:30px;right:0px;}#footer{background-color:#FFFF00;color:#000000;text-align:center;position:absolute;left:0px;bottom:0px;height:20px;right:0px;}#center{position:absolute;left:170px;top:30px;bottom:20px;right:0px;} .c{margin:15px auto;text-align:left; width:430px;}.ze{background-color:#CCCCCC;width:100%; border-color:#FFFFFF;border-style:solid;border-width:thin;padding:3px;}.cen{text-align:center;width:100%;} .cen1{height:100%;position:absolute;min-height:600px;}.ueber{position:relative;height:100%;width:100%;max-width:800px;margin:auto;text-align:left;} ul#nav {width: 160px;margin: 0;padding: 0px;} ul#nav li {list-style: none;margin: 0px; padding: 0;} ul#nav a, .ll a {display:block;padding: 3px;text-decoration: none;font-weight: bold;color: #0000CC; background-color: #cccccc;border: 1px solid black;border-left-color: white; border-top-color: white;} ul#nav a:hover, .ll a:hover {border-color: white;border-left-color: black; border-top-color: black;color: white; background-color: #999999;}.ull{position:relative;left:-30px;width:140px; font-size:12px;} .b{font-weight:bold;text-decoration:none;}.bo{border-bottom:medium #FFFFFF solid;}.bs{border-bottom:thin #FFFFFF solid;}.pf a{text-decoration:none;color:#007755;}.gsm{width:15px;height:25px;bottom:0px;font-size:0px;position:absolute;}.dfk{color:#0000ff;}.ea td{vertical-align:top;} .r{color:#FF0000;}.g{color:#00FF00;}.bgb{background-color:#0000CC;color:#FFFF00;} .men {} ul#nav li ul {display: none;}ul#nav li:hover ul {display: block;} #if{position:absolute;width:100%;height:100%;border:none;}.rp{text-decoration:none; color:#007755;} .bf{color:#FFFFFF; background-color:#000000; padding: 0 0px}.nul{text-decoration: none; color:#000000;}
|
|
9
|
-
</style>
|
|
10
|
-
<script type="text/javascript">
|
|
11
|
-
var login=false; function sett() {t=window.frames.centerframe.document.title;document.getElementById('head').firstChild.nodeValue=t;document.title=t;} function act(aid){document.getElementById(aid).style.display="block";}function deact(did){document.getElementById(did).style.display="none";}
|
|
12
|
-
</script>
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<div class="cen cen1" style="background-color:#FFFFFF;">
|
|
16
|
-
<div class="ueber">
|
|
17
|
-
<div id="head">BL-NET</div>
|
|
18
|
-
<div id="left">
|
|
19
|
-
<ul id="nav">
|
|
20
|
-
<li><a href="can.htm" target="centerframe" onClick="act('bus');">CAN-Bus</a>
|
|
21
|
-
<ul id="bus" class="ull">
|
|
22
|
-
<li><a href="a_ein.htm?blaE=1" target="centerframe" onClick="act('bus');">analoge
|
|
23
|
-
Eingänge</a></li>
|
|
24
|
-
<li><a href="d_ein.htm?blaE=1" target="centerframe" onClick="act('bus');">digitale
|
|
25
|
-
Eingänge</a></li>
|
|
26
|
-
<br></ul>
|
|
27
|
-
</li>
|
|
28
|
-
<li><a href="GRAFIK.htm" target="_self">Schema</a></li>
|
|
29
|
-
<li><a href="gsm.htm" target="centerframe" onClick="deact('bus');">GSM</a></li>
|
|
30
|
-
<li><a href="ether.htm" target="centerframe" onClick="deact('bus');">Ethernet</a></li>
|
|
31
|
-
<li><a href="passw.htm" target="centerframe" onClick="deact('bus');">Passwörter</a></li>
|
|
32
|
-
<li><a href="data.htm" target="centerframe" onClick="deact('bus');">Datenverwaltung</a></li>
|
|
33
|
-
<li><a href="datalog.htm" target="centerframe" onClick="deact('bus');">Datenlogging</a></li>
|
|
34
|
-
</ul>
|
|
35
|
-
<br>
|
|
36
|
-
<div class="cen ll"><a href="#" id='ind'
|
|
37
|
-
onclick="if(login){deact('login');login=false;}else { act('login'); login=true;}"
|
|
38
|
-
class="b">Login</a> <a id='outd' style='display:none;' href="main.html?blL=1"
|
|
39
|
-
class="b">Logout</a>
|
|
40
|
-
<div><br>
|
|
41
|
-
<div id='logu'><b></div>
|
|
42
|
-
</b></div>
|
|
43
|
-
</div>
|
|
44
|
-
<br>
|
|
45
|
-
<div style="display:none;" id="login">
|
|
46
|
-
<form method="post" action="main.html">
|
|
47
|
-
<div><input name="blu" type="radio" value="1"/>Experte<br/><input name="u" type="radio" value="2"/>Anwender<br/>
|
|
48
|
-
<input name="blu" type="radio" value="5"/>nur ansehen<br/></div>
|
|
49
|
-
Passwort:<br/><input name="blp" type="password" size="10" maxlength="8"/><br/> <input name="bll"
|
|
50
|
-
type="submit"
|
|
51
|
-
value="Login"/>
|
|
52
|
-
</form>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<div id="center">
|
|
56
|
-
<iframe id="if" name="centerframe" src="begr.htm" onload="sett();"></iframe>
|
|
57
|
-
</div>
|
|
58
|
-
<div id="footer">Bootloader-NET V2.19 DE © 2011 <a href="http://www.ta.co.at/" target="_blank">TA</a>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</body>
|
|
63
|
-
</html>
|
|
Binary file
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
import threading
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Server:
|
|
8
|
-
def __init__(self, server):
|
|
9
|
-
"""
|
|
10
|
-
Expects subclass of TCPServer as argument
|
|
11
|
-
"""
|
|
12
|
-
self._server = server
|
|
13
|
-
self._server_started_event = threading.Event()
|
|
14
|
-
self._server_running = False
|
|
15
|
-
|
|
16
|
-
def _run_server(self):
|
|
17
|
-
|
|
18
|
-
print("Server started, serving on port {}".format(self.get_port()))
|
|
19
|
-
|
|
20
|
-
# notify about start
|
|
21
|
-
self._server_started_event.set()
|
|
22
|
-
self._server_running = True
|
|
23
|
-
|
|
24
|
-
try:
|
|
25
|
-
self._server.serve_forever()
|
|
26
|
-
finally:
|
|
27
|
-
self._cleanup_server()
|
|
28
|
-
|
|
29
|
-
def _cleanup_server(self):
|
|
30
|
-
self._server_running = False
|
|
31
|
-
self._server.server_close()
|
|
32
|
-
# Here, server was stopped
|
|
33
|
-
print("Server stopped")
|
|
34
|
-
|
|
35
|
-
def stop_server(self):
|
|
36
|
-
"""
|
|
37
|
-
Close server forcibly
|
|
38
|
-
:return:
|
|
39
|
-
"""
|
|
40
|
-
print("Stopping server")
|
|
41
|
-
if self._server_running:
|
|
42
|
-
self._server.shutdown()
|
|
43
|
-
|
|
44
|
-
def start_server(self, timeout=10):
|
|
45
|
-
"""
|
|
46
|
-
Start server thread as daemon
|
|
47
|
-
As such the program will automatically close the thread on exit of all non-daemon threads
|
|
48
|
-
:return:
|
|
49
|
-
"""
|
|
50
|
-
self._server_started_event.clear()
|
|
51
|
-
# start webserver as daemon => will automatically be closed when non-daemon threads are closed
|
|
52
|
-
t = threading.Thread(target=self._run_server, daemon=True)
|
|
53
|
-
# Start webserver
|
|
54
|
-
t.start()
|
|
55
|
-
# wait (non-busy) for successful start
|
|
56
|
-
self._server_started_event.wait(timeout=timeout)
|
|
57
|
-
|
|
58
|
-
def get_port(self):
|
|
59
|
-
return self._server.server_address[1]
|
pyblnet/tests/test_web.py
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
# general requirements
|
|
5
|
-
import unittest
|
|
6
|
-
from .test_structure.server_control import Server
|
|
7
|
-
from .test_structure.blnet_mock_server import BLNETServer, BLNETRequestHandler, PASSWORD
|
|
8
|
-
|
|
9
|
-
# For the server in this case
|
|
10
|
-
import time
|
|
11
|
-
|
|
12
|
-
# For the tests
|
|
13
|
-
from .. import BLNET, test_blnet, BLNETWeb
|
|
14
|
-
from .web_raw.web_state import STATE, STATE_ANALOG, STATE_DIGITAL
|
|
15
|
-
|
|
16
|
-
ADDRESS = "localhost"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class OfflineTest(unittest.TestCase):
|
|
20
|
-
|
|
21
|
-
url = ADDRESS
|
|
22
|
-
|
|
23
|
-
def test_blnet(self):
|
|
24
|
-
"""Test finding the blnet"""
|
|
25
|
-
self.assertFalse(test_blnet(self.url, timeout=10))
|
|
26
|
-
|
|
27
|
-
def test_blnet_web(self):
|
|
28
|
-
try:
|
|
29
|
-
BLNETWeb(self.url)
|
|
30
|
-
self.fail("Didn't throw an exception for offline blnetweb")
|
|
31
|
-
except ValueError:
|
|
32
|
-
pass
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class BLNETWebTest(unittest.TestCase):
|
|
36
|
-
|
|
37
|
-
server = None
|
|
38
|
-
server_control = None
|
|
39
|
-
port = 0
|
|
40
|
-
url = "http://localhost:80"
|
|
41
|
-
|
|
42
|
-
def setUp(self):
|
|
43
|
-
# Create an arbitrary subclass of TCP Server as the server to be started
|
|
44
|
-
# Here, it is an Simple HTTP file serving server
|
|
45
|
-
handler = BLNETRequestHandler
|
|
46
|
-
|
|
47
|
-
max_retries = 10
|
|
48
|
-
r = 0
|
|
49
|
-
while not self.server:
|
|
50
|
-
try:
|
|
51
|
-
# Connect to any open port
|
|
52
|
-
self.server = BLNETServer((ADDRESS, 0), handler)
|
|
53
|
-
except OSError:
|
|
54
|
-
if r < max_retries:
|
|
55
|
-
r += 1
|
|
56
|
-
else:
|
|
57
|
-
raise
|
|
58
|
-
time.sleep(1)
|
|
59
|
-
|
|
60
|
-
self.server_control = Server(self.server)
|
|
61
|
-
self.server.set_password(PASSWORD)
|
|
62
|
-
self.port = self.server_control.get_port()
|
|
63
|
-
self.url = "http://{}:{}".format(ADDRESS, self.port)
|
|
64
|
-
# Start test server before running any tests
|
|
65
|
-
self.server_control.start_server()
|
|
66
|
-
|
|
67
|
-
def test_blnet(self):
|
|
68
|
-
"""Test finding the blnet"""
|
|
69
|
-
self.assertTrue(test_blnet(self.url, timeout=10))
|
|
70
|
-
self.server.set_blocked()
|
|
71
|
-
self.assertTrue(test_blnet(self.url, timeout=10))
|
|
72
|
-
|
|
73
|
-
def test_blnet_web_log_in(self):
|
|
74
|
-
"""
|
|
75
|
-
Test logging in via different urls
|
|
76
|
-
and that log out after a with clause happens correctly
|
|
77
|
-
"""
|
|
78
|
-
with BLNETWeb(self.url, password=PASSWORD, timeout=10) as blnet:
|
|
79
|
-
self.assertTrue(blnet.logged_in())
|
|
80
|
-
# test without http
|
|
81
|
-
blnet = BLNETWeb(
|
|
82
|
-
"{}:{}".format(ADDRESS, self.port), password=PASSWORD, timeout=10
|
|
83
|
-
)
|
|
84
|
-
with blnet as blnet:
|
|
85
|
-
self.assertTrue(blnet.logged_in())
|
|
86
|
-
|
|
87
|
-
def test_blnet_fetch(self):
|
|
88
|
-
"""Test fetching data in higher level class"""
|
|
89
|
-
self.assertEqual(
|
|
90
|
-
BLNET(
|
|
91
|
-
ADDRESS, password=PASSWORD, timeout=10, use_ta=False, web_port=self.port
|
|
92
|
-
).fetch(),
|
|
93
|
-
STATE,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
def test_blnet_fetch_fine_grained(self):
|
|
97
|
-
"""Test fetching data in higher level class"""
|
|
98
|
-
fetched = STATE
|
|
99
|
-
|
|
100
|
-
def scratch_tuple(type, id, ret):
|
|
101
|
-
return fetched[type][id][ret], fetched[type][id], fetched
|
|
102
|
-
|
|
103
|
-
blnet = BLNET(
|
|
104
|
-
ADDRESS, password=PASSWORD, timeout=10, use_ta=False, web_port=self.port
|
|
105
|
-
)
|
|
106
|
-
self.assertEqual(
|
|
107
|
-
blnet.get_analog_value(id=5, cached=fetched),
|
|
108
|
-
scratch_tuple("analog", 5, "value"),
|
|
109
|
-
)
|
|
110
|
-
self.assertEqual(
|
|
111
|
-
blnet.get_analog_value(name="TSP.oben", cached=fetched),
|
|
112
|
-
scratch_tuple("analog", 2, "value"),
|
|
113
|
-
)
|
|
114
|
-
self.assertEqual(
|
|
115
|
-
blnet.get_digital_value(id=1, cached=fetched),
|
|
116
|
-
scratch_tuple("digital", 1, "value"),
|
|
117
|
-
)
|
|
118
|
-
self.assertEqual(
|
|
119
|
-
blnet.get_digital_mode(id=1, cached=fetched),
|
|
120
|
-
scratch_tuple("digital", 1, "mode"),
|
|
121
|
-
)
|
|
122
|
-
# test auto-fetching
|
|
123
|
-
self.assertEqual(
|
|
124
|
-
blnet.get_digital_mode(id=1), scratch_tuple("digital", 1, "mode")
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
def test_blnet_turn(self):
|
|
128
|
-
"""Test higher level turn methods"""
|
|
129
|
-
blnet = BLNET(
|
|
130
|
-
ADDRESS, password=PASSWORD, timeout=10, use_ta=False, web_port=self.port
|
|
131
|
-
)
|
|
132
|
-
blnet.turn_on(10)
|
|
133
|
-
self.assertEqual(self.server.get_node("A"), "2")
|
|
134
|
-
blnet.turn_on(9)
|
|
135
|
-
self.assertEqual(self.server.get_node("9"), "2")
|
|
136
|
-
blnet.turn_auto(8)
|
|
137
|
-
self.assertEqual(self.server.get_node("8"), "3")
|
|
138
|
-
blnet.turn_off(1)
|
|
139
|
-
self.assertEqual(self.server.get_node("1"), "1")
|
|
140
|
-
|
|
141
|
-
def test_blnet_fetch_error(self):
|
|
142
|
-
"""Test fetching data in higher level class with missing password (or otherwise denied access to the data)"""
|
|
143
|
-
self.assertEqual(
|
|
144
|
-
BLNET(
|
|
145
|
-
ADDRESS, password=None, timeout=10, use_ta=False, web_port=self.port
|
|
146
|
-
).fetch(),
|
|
147
|
-
{"analog": {}, "digital": {}, "energy": {}, "power": {}, "speed": {}},
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
def test_blnet_web_analog(self):
|
|
151
|
-
"""Test reading analog values"""
|
|
152
|
-
with BLNETWeb(self.url, password=PASSWORD, timeout=10) as blnet:
|
|
153
|
-
self.assertEqual(blnet.read_analog_values(), STATE_ANALOG)
|
|
154
|
-
|
|
155
|
-
def test_blnet_web_digital(self):
|
|
156
|
-
"""Test reading digital values"""
|
|
157
|
-
with BLNETWeb(self.url, password=PASSWORD, timeout=10) as blnet:
|
|
158
|
-
self.assertEqual(blnet.read_digital_values(), STATE_DIGITAL)
|
|
159
|
-
|
|
160
|
-
def test_blnet_web_set_digital(self):
|
|
161
|
-
"""Test setting digital values"""
|
|
162
|
-
with BLNETWeb(self.url, password=PASSWORD, timeout=10) as blnet:
|
|
163
|
-
blnet.set_digital_value(10, "2")
|
|
164
|
-
self.assertEqual(self.server.get_node("A"), "2")
|
|
165
|
-
blnet.set_digital_value(9, "EIN")
|
|
166
|
-
self.assertEqual(self.server.get_node("9"), "2")
|
|
167
|
-
blnet.set_digital_value(8, "auto")
|
|
168
|
-
self.assertEqual(self.server.get_node("8"), "3")
|
|
169
|
-
blnet.set_digital_value(1, "on")
|
|
170
|
-
self.assertEqual(self.server.get_node("1"), "2")
|
|
171
|
-
blnet.set_digital_value(1, "AUS")
|
|
172
|
-
self.assertEqual(self.server.get_node("1"), "1")
|
|
173
|
-
blnet.set_digital_value(5, 3)
|
|
174
|
-
self.assertEqual(self.server.get_node("5"), "3")
|
|
175
|
-
blnet.set_digital_value(4, True)
|
|
176
|
-
self.assertEqual(self.server.get_node("4"), "2")
|
|
177
|
-
blnet.set_digital_value(6, False)
|
|
178
|
-
self.assertEqual(self.server.get_node("6"), "1")
|
|
179
|
-
try:
|
|
180
|
-
blnet.set_digital_value(0, "EIN")
|
|
181
|
-
self.fail("Didn't catch wrong id 0")
|
|
182
|
-
except ValueError:
|
|
183
|
-
pass
|
|
184
|
-
try:
|
|
185
|
-
blnet.set_digital_value(16, "EIN")
|
|
186
|
-
self.fail("Didn't catch wrong id 16")
|
|
187
|
-
except ValueError:
|
|
188
|
-
pass
|
|
189
|
-
|
|
190
|
-
def test_blnet_web_log_out(self):
|
|
191
|
-
"""Test setting digital values"""
|
|
192
|
-
blnet = BLNETWeb(self.url, password=PASSWORD, timeout=10)
|
|
193
|
-
self.assertFalse(blnet.logged_in())
|
|
194
|
-
with blnet as blnet:
|
|
195
|
-
self.assertTrue(blnet.logged_in())
|
|
196
|
-
self.assertFalse(blnet.logged_in())
|
|
197
|
-
|
|
198
|
-
def tearDown(self):
|
|
199
|
-
self.server_control.stop_server()
|
|
200
|
-
pass
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if __name__ == "__main__":
|
|
204
|
-
unittest.main()
|
|
File without changes
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
STATE = {
|
|
2
|
-
"analog": {
|
|
3
|
-
1: {
|
|
4
|
-
"id": "1",
|
|
5
|
-
"name": "TKollektor",
|
|
6
|
-
"unit_of_measurement": "°C",
|
|
7
|
-
"value": "5.3",
|
|
8
|
-
},
|
|
9
|
-
2: {
|
|
10
|
-
"id": "2",
|
|
11
|
-
"name": "TSP.oben",
|
|
12
|
-
"unit_of_measurement": "°C",
|
|
13
|
-
"value": "46.3",
|
|
14
|
-
},
|
|
15
|
-
3: {
|
|
16
|
-
"id": "3",
|
|
17
|
-
"name": "TSP.unten",
|
|
18
|
-
"unit_of_measurement": "°C",
|
|
19
|
-
"value": "53.1",
|
|
20
|
-
},
|
|
21
|
-
4: {
|
|
22
|
-
"id": "4",
|
|
23
|
-
"name": "THeizkr.VL",
|
|
24
|
-
"unit_of_measurement": "°C",
|
|
25
|
-
"value": "44.8",
|
|
26
|
-
},
|
|
27
|
-
5: {
|
|
28
|
-
"id": "5",
|
|
29
|
-
"name": "Temp.Aussen",
|
|
30
|
-
"unit_of_measurement": "°C",
|
|
31
|
-
"value": "-72.3",
|
|
32
|
-
},
|
|
33
|
-
6: {
|
|
34
|
-
"id": "6",
|
|
35
|
-
"name": "Temp.Raum",
|
|
36
|
-
"unit_of_measurement": "°C",
|
|
37
|
-
"value": "24.6",
|
|
38
|
-
},
|
|
39
|
-
7: {
|
|
40
|
-
"id": "7",
|
|
41
|
-
"name": "T Kaminofen",
|
|
42
|
-
"unit_of_measurement": "°C",
|
|
43
|
-
"value": "20.9",
|
|
44
|
-
},
|
|
45
|
-
9: {
|
|
46
|
-
"id": "9",
|
|
47
|
-
"name": "TZirku.RL",
|
|
48
|
-
"unit_of_measurement": "°C",
|
|
49
|
-
"value": "36.6",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
"digital": {
|
|
53
|
-
1: {"id": "1", "mode": "AUTO", "name": "Pumpe-Solar", "value": "AUS"},
|
|
54
|
-
2: {"id": "2", "mode": "AUTO", "name": "Pumpe-Hzkr", "value": "EIN"},
|
|
55
|
-
5: {"id": "5", "mode": "AUTO", "name": "Anf.Kessel", "value": "AUS"},
|
|
56
|
-
6: {"id": "6", "mode": "HAND", "name": "Vent.Solar", "value": "AUS"},
|
|
57
|
-
7: {"id": "7", "mode": "AUTO", "name": "P Kaminofen", "value": "EIN"},
|
|
58
|
-
10: {"id": "10", "mode": "HAND", "name": "WW-Pumpe1", "value": "AUS"},
|
|
59
|
-
},
|
|
60
|
-
"energy": {},
|
|
61
|
-
"power": {},
|
|
62
|
-
"speed": {},
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
STATE_ALTERNATIVE = {
|
|
66
|
-
"analog": {
|
|
67
|
-
2: {
|
|
68
|
-
"id": "2",
|
|
69
|
-
"name": "TSP.oben",
|
|
70
|
-
"value": "47.1",
|
|
71
|
-
"unit_of_measurement": "°C",
|
|
72
|
-
},
|
|
73
|
-
3: {
|
|
74
|
-
"id": "3",
|
|
75
|
-
"name": "TSP.unten",
|
|
76
|
-
"value": "57.8",
|
|
77
|
-
"unit_of_measurement": "°C",
|
|
78
|
-
},
|
|
79
|
-
4: {
|
|
80
|
-
"id": "4",
|
|
81
|
-
"name": "THeizkr.VL",
|
|
82
|
-
"value": "45.8",
|
|
83
|
-
"unit_of_measurement": "°C",
|
|
84
|
-
},
|
|
85
|
-
5: {
|
|
86
|
-
"id": "5",
|
|
87
|
-
"name": "Temp.Aussen",
|
|
88
|
-
"value": "1.1",
|
|
89
|
-
"unit_of_measurement": "°C",
|
|
90
|
-
},
|
|
91
|
-
6: {
|
|
92
|
-
"id": "6",
|
|
93
|
-
"name": "Temp.Raum",
|
|
94
|
-
"value": "24.1",
|
|
95
|
-
"unit_of_measurement": "°C",
|
|
96
|
-
},
|
|
97
|
-
7: {
|
|
98
|
-
"id": "7",
|
|
99
|
-
"name": "T Kaminofen",
|
|
100
|
-
"value": "55.8",
|
|
101
|
-
"unit_of_measurement": "°C",
|
|
102
|
-
},
|
|
103
|
-
9: {
|
|
104
|
-
"id": "9",
|
|
105
|
-
"name": "TZirku.RL",
|
|
106
|
-
"value": "22.4",
|
|
107
|
-
"unit_of_measurement": "°C",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
"digital": {
|
|
111
|
-
1: {"id": "1", "name": "Pumpe-Solar", "mode": "AUTO", "value": "AUS"},
|
|
112
|
-
2: {"id": "2", "name": "Pumpe-Hzkr", "mode": "AUTO", "value": "EIN"},
|
|
113
|
-
5: {"id": "5", "name": "Anf.Kessel", "mode": "AUTO", "value": "AUS"},
|
|
114
|
-
6: {"id": "6", "name": "Vent.Solar", "mode": "HAND", "value": "AUS"},
|
|
115
|
-
7: {"id": "7", "name": "P Kaminofen", "mode": "AUTO", "value": "EIN"},
|
|
116
|
-
10: {"id": "10", "name": "WW-Pumpe1", "mode": "HAND", "value": "AUS"},
|
|
117
|
-
},
|
|
118
|
-
"speed": {},
|
|
119
|
-
"energy": {},
|
|
120
|
-
"power": {},
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
STATE_ANALOG = [
|
|
124
|
-
{"id": "1", "name": "TKollektor", "unit_of_measurement": "°C", "value": "5.3"},
|
|
125
|
-
{"id": "2", "name": "TSP.oben", "unit_of_measurement": "°C", "value": "46.3"},
|
|
126
|
-
{"id": "3", "name": "TSP.unten", "unit_of_measurement": "°C", "value": "53.1"},
|
|
127
|
-
{"id": "4", "name": "THeizkr.VL", "unit_of_measurement": "°C", "value": "44.8"},
|
|
128
|
-
{"id": "5", "name": "Temp.Aussen", "unit_of_measurement": "°C", "value": "-72.3"},
|
|
129
|
-
{"id": "6", "name": "Temp.Raum", "unit_of_measurement": "°C", "value": "24.6"},
|
|
130
|
-
{"id": "7", "name": "T Kaminofen", "unit_of_measurement": "°C", "value": "20.9"},
|
|
131
|
-
{"id": "9", "name": "TZirku.RL", "unit_of_measurement": "°C", "value": "36.6"},
|
|
132
|
-
]
|
|
133
|
-
|
|
134
|
-
STATE_ANALOG_ALTERNATIVE = [
|
|
135
|
-
{"id": "2", "name": "TSP.oben", "unit_of_measurement": "°C", "value": "47.1"},
|
|
136
|
-
{"id": "3", "name": "TSP.unten", "unit_of_measurement": "°C", "value": "57.8"},
|
|
137
|
-
{"id": "4", "name": "THeizkr.VL", "unit_of_measurement": "°C", "value": "45.8"},
|
|
138
|
-
{"id": "5", "name": "Temp.Aussen", "unit_of_measurement": "°C", "value": "1.1"},
|
|
139
|
-
{"id": "6", "name": "Temp.Raum", "unit_of_measurement": "°C", "value": "24.1"},
|
|
140
|
-
{"id": "7", "name": "T Kaminofen", "unit_of_measurement": "°C", "value": "55.8"},
|
|
141
|
-
{"id": "9", "name": "TZirku.RL", "unit_of_measurement": "°C", "value": "22.4"},
|
|
142
|
-
]
|
|
143
|
-
|
|
144
|
-
STATE_DIGITAL = [
|
|
145
|
-
{"id": "1", "mode": "AUTO", "name": "Pumpe-Solar", "value": "AUS"},
|
|
146
|
-
{"id": "2", "mode": "AUTO", "name": "Pumpe-Hzkr", "value": "EIN"},
|
|
147
|
-
{"id": "5", "mode": "AUTO", "name": "Anf.Kessel", "value": "AUS"},
|
|
148
|
-
{"id": "6", "mode": "HAND", "name": "Vent.Solar", "value": "AUS"},
|
|
149
|
-
{"id": "7", "mode": "AUTO", "name": "P Kaminofen", "value": "EIN"},
|
|
150
|
-
{"id": "10", "mode": "HAND", "name": "WW-Pumpe1", "value": "AUS"},
|
|
151
|
-
]
|
|
File without changes
|