first commit

This commit is contained in:
Asaril 2020-03-12 02:30:41 +01:00
commit 220c5585bb
16 changed files with 270 additions and 0 deletions

1
_data/body_21.txt Normal file
View file

@ -0,0 +1 @@
A100000000000000132c5386000000000000000000000000c8b1ad8d

1
_data/body_22.txt Normal file
View file

@ -0,0 +1 @@
A20000000000000000000000000000000000000000000000c9950d3f

1
_data/body_24.txt Normal file
View file

@ -0,0 +1 @@
A00000000000000001000000000000000000000000000000bec650a1

1
_data/body_25.txt Normal file
View file

@ -0,0 +1 @@
A00000000000000001000000000000000000000000000000bec650a1

1
_data/body_28a.txt Normal file
View file

@ -0,0 +1 @@
A5000000000000000100000000000000000000000000000056e5abd9

1
_data/body_28b.txt Normal file
View file

@ -0,0 +1 @@
A5000000000000000100000000000000000000000000000056e5abd9

0
_data/body_29.txt Normal file
View file

6
_data/hdr_21.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html

6
_data/hdr_22.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:11 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html

6
_data/hdr_24.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:36:26 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html

6
_data/hdr_25.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html

6
_data/hdr_28a.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html

6
_data/hdr_28b.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html

6
_data/hdr_29.txt Normal file
View file

@ -0,0 +1,6 @@
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:11 GMT
Server: Apache
Content-Length: 0
Content-Type: text/html

165
scale_proto.md Normal file
View file

@ -0,0 +1,165 @@
# soehnle web connect
url
http://bridge1.soehnle.de/devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6
## dataservice message types
- 0x21:
- A10000000000000009c4914c0000000000000000000000001d095ec4
- 0x22:
- A20000000000000000000000000000000000000000000000c9950d3f
- 0x24: measurement
- 24e4e40901a2c1db020200d49c0138132c560e233c00000000000000000039f052f7
- A00000000000000001000000000000000000000000000000bec650a1
- 0x25: presence / registration
- 25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6
- A00000000000000001000000000000000000000000000000bec650a1
- 0x28:
- A5000000000000000100000000000000000000000000000056e5abd9
### measurement (0x24)
24 e4e40901a2c1 db020200d49c0138 132c560e 233c 0000 0000 0000000000 39f052f7
24 e4e40901a2c1 db020200d49c0138 09c492cb 233c 1303 15f5 0000000000 5848fded
MT bridge_id wght watr?
{
msg_type: u8
bridge_id: u8[6] (mac)
scale_id?: u8[8]
?
weight: u16 (kg/100)
water?: u16
}
## req
ar/2020:01:12:26 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:12:37 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:12:37 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=28e4e40901a2c1000000000000e6ccaab5000020ea00000000000000000078c4249e HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:12:48 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=28e4e40901a2c1000000000000e2707d59000020f600000000000000000042ddf39d HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:12:48 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=21e4e40901a2c100000000000000000000000000000000000000000000006c395ed8 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:13:00 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=21e4e40901a2c100000000000000000000000000000000000000000000006c395ed8 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:13:00 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:13:11 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:13:11 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=29e4e40901a2c10000000000000000000000000000000000000000000000544f40d9 HTTP/1.1" 499 0 "-" "-"
192.168.178.38 - - [12/Mar/2020 01:25:44] "GET /devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:25:55] "GET /devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:25:55] "GET /devicedataservice/dataservice?data=28e4e40901a2c1000000000000fb6c646900000012000000000000000000546ced23 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:26:06] "GET /devicedataservice/dataservice?data=28e4e40901a2c1000000000000f9f6c1d50000001e0000000000000000002390bef9 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:26:06] "GET /devicedataservice/dataservice?data=21e4e40901a2c100000000000000000000000000000000000000000000006c395ed8 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:26:17] "GET /devicedataservice/dataservice?data=21e4e40901a2c100000000000000000000000000000000000000000000006c395ed8 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:26:17] "GET /devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.0" 200 -
192.168.178.38 - - [12/Mar/2020 01:26:28] "GET /devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.0" 200 -
curl -D hdr_25.txt "http://bridge1.soehnle.de/devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6" > body_25.txt
curl -D hdr_28a.txt "http://bridge1.soehnle.de/devicedataservice/dataservice?data=28e4e40901a2c1000000000000e6ccaab5000020ea00000000000000000078c4249e" > body_28a.txt
curl -D hdr_28b.txt "http://bridge1.soehnle.de/devicedataservice/dataservice?data=28e4e40901a2c1000000000000e2707d59000020f600000000000000000042ddf39d" > body_28b.txt
curl -D hdr_21.txt "http://bridge1.soehnle.de/devicedataservice/dataservice?data=21e4e40901a2c100000000000000000000000000000000000000000000006c395ed8" > body_21.txt
curl -D hdr_22.txt "http://bridge1.soehnle.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0" > body_22.txt
curl -D hdr_29.txt "http://bridge1.soehnle.de/devicedataservice/dataservice?data=29e4e40901a2c10000000000000000000000000000000000000000000000544f40d9" > body_29.txt
## raw
> GET /devicedataservice/dataservice?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6 HTTP/1.1
> Host: bridge1.soehnle.de
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 12 Mar 2020 00:02:19 GMT
< Server: Apache
< Content-Length: 56
< Content-Type: text/html
<
21
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html
A100000000000000132c5386000000000000000000000000c8b1ad8d
22
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:11 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html
A20000000000000000000000000000000000000000000000c9950d3f
25
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html
A00000000000000001000000000000000000000000000000bec650a1
28a
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html
A5000000000000000100000000000000000000000000000056e5abd9
28b
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:10 GMT
Server: Apache
Content-Length: 56
Content-Type: text/html
A5000000000000000100000000000000000000000000000056e5abd9
29
HTTP/1.1 200 OK
Date: Thu, 12 Mar 2020 00:21:11 GMT
Server: Apache
Content-Length: 0
Content-Type: text/html
## measurements
### without bia
93.219.157.105 - - [12/Mar/2020:01:31:46 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c0138132c560e233c00000000000000000039f052f7 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:31:57 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c0138132c560e233c00000000000000000039f052f7 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:31:57 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:32:08 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:32:08 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=29e4e40901a2c10000000000000000000000000000000000000000000000544f40d9 HTTP/1.1" 499 0 "-" "-"
### with bia
93.219.157.105 - - [12/Mar/2020:01:32:41 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c492cb233c130315f500000000005848fded HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:32:52 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c492cb233c130315f500000000005848fded HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:32:52 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:33:03 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:01:33:03 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=29e4e40901a2c10000000000000000000000000000000000000000000000544f40d9 HTTP/1.1" 499 0 "-" "-"
### bia stored
93.219.157.105 - - [12/Mar/2020:02:09:35 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c49b04233c12e715ef00000000004f41ae41 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:09:46 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c49b04233c12e715ef00000000004f41ae41 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:09:46 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c49b1d238c12cc15c9000000000025ef6a3e HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:09:57 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c49b1d238c12cc15c9000000000025ef6a3e HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:09:57 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c49b4823501319163f00000000006fbfa447 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:10:08 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=24e4e40901a2c1db020200d49c013809c49b4823501319163f00000000006fbfa447 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:10:08 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:10:19 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=22e4e40901a2c1000000000000000000000000000000000000000000000028987bc0 HTTP/1.1" 200 56 "-" "-"
93.219.157.105 - - [12/Mar/2020:02:10:19 +0100] "GET http://scalefix.asaril.de/devicedataservice/dataservice?data=29e4e40901a2c10000000000000000000000000000000000000000000000544f40d9 HTTP/1.1" 499 0 "-" "-"

57
scalesrv.py Normal file
View file

@ -0,0 +1,57 @@
import http.server
import socketserver
import urllib.parse
import urllib.request
PORT=18001
DATA_SRV_PATH = "/devicedataservice/dataservice"
#?data=25e4e40901a2c100000000000000000000413a41040000000000000000001d9222e6
RESPONSES = {
0x24:"A00000000000000001000000000000000000000000000000bec650a1",
0x22:"A20000000000000000000000000000000000000000000000c9950d3f",
0x25:"A00000000000000001000000000000000000000000000000bec650a1",
0x28:"A5000000000000000100000000000000000000000000000056e5abd9",
0x21:"A10000000000000009c4914c0000000000000000000000001d095ec4",
0x29:""
}
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
parts = urllib.parse.urlsplit(self.path)
if parts.path == DATA_SRV_PATH:
self.do_dataservice(parts)
def do_dataservice(self, urlparts):
params = urllib.parse.parse_qs(urlparts.query)
if 'data' not in params:
print ('got message without data: ' + urlparts.query)
self.send_error(400,'invalid message')
data_str = params['data'][0]
bin_data = bytes.fromhex(data_str)
msg_type = bin_data[0]
if msg_type not in RESPONSES:
print ('got unknown message: ' + data_str)
self.send_error(400,'unknown message')
response = RESPONSES[msg_type]
self.send_response(http.server.HTTPStatus.OK)
self.send_header("Content-type", "text/html")
self.send_header("Content-Length", len(response))
self.end_headers()
self.wfile.write(response.encode('utf-8'))
with socketserver.TCPServer(("",PORT), Handler) as httpd:
print('started at port %d'%PORT)
httpd.serve_forever()