1
0
forked from Tank/braga
This commit is contained in:
root 2026-03-10 18:16:48 +00:00
parent ce0babc72f
commit 0d33899968
12 changed files with 3234 additions and 9 deletions

View File

@ -0,0 +1 @@
窒、temp、dateウ2026-03-10 18:10:23うdateウ2026-03-10 18:14:45、temp

View File

@ -0,0 +1 @@
窒、temp、dateウ2026-03-10 18:10:23うdateウ2026-03-10 18:14:45、temp

View File

@ -0,0 +1 @@
窒、temp、dateウ2026-03-10 18:10:23うdateウ2026-03-10 18:14:45、temp

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,3 +5,6 @@ curl -LJO \
'https://docs.google.com/spreadsheets/d/e/2PACX-1vQrEP1eukYo2fnNs5zsQgmZTcS1PzIDYL46Lw7un1_v70jP6mgBFqpjOJno9ic-W03PrlxsC3s3YiWA/pub?gid=0&single=true&output=csv' 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQrEP1eukYo2fnNs5zsQgmZTcS1PzIDYL46Lw7un1_v70jP6mgBFqpjOJno9ic-W03PrlxsC3s3YiWA/pub?gid=0&single=true&output=csv'
mv braga-1.csv tanks.csv mv braga-1.csv tanks.csv
sudo iptables -A INPUT -p tcp --dport 4888 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 4999 -j ACCEPT

3005
logs/error.log Normal file → Executable file

File diff suppressed because it is too large Load Diff

153
logs/sockets.log Normal file → Executable file
View File

@ -0,0 +1,153 @@
2026/03/09 11:27:31 [info] 2460676#0: *154 client 178.176.180.141:14535 connected to 0.0.0.0:4888
2026/03/09 11:29:09 [info] 2466480#0: *2 client 178.176.180.141:28820 connected to 0.0.0.0:4999
2026/03/09 11:29:09 [error] 2466480#0: *2 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:29:11 [info] 2466480#0: *12 client 178.176.180.141:1429 connected to 0.0.0.0:4999
2026/03/09 11:29:11 [error] 2466480#0: *12 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:29:40 [info] 2466480#0: *21 client 178.176.180.141:13557 connected to 0.0.0.0:4999
2026/03/09 11:29:40 [error] 2466480#0: *21 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:29:47 [info] 2466480#0: *26 client 178.176.180.141:21145 connected to 0.0.0.0:4888
2026/03/09 11:29:58 [info] 2466480#0: *31 client 178.176.180.141:51144 connected to 0.0.0.0:4999
2026/03/09 11:29:58 [error] 2466480#0: *31 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:31:37 [info] 2466480#0: *109 client 178.176.180.141:9784 connected to 0.0.0.0:4999
2026/03/09 11:31:37 [error] 2466480#0: *109 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:31:45 [info] 2466480#0: *111 client 178.176.180.141:32216 connected to 0.0.0.0:4999
2026/03/09 11:31:45 [error] 2466480#0: *111 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:31:47 [info] 2466480#0: *112 client 178.176.180.141:55448 connected to 0.0.0.0:4999
2026/03/09 11:31:47 [error] 2466480#0: *112 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:31:50 [info] 2466480#0: *119 client 178.176.180.141:24988 connected to 0.0.0.0:4999
2026/03/09 11:31:50 [error] 2466480#0: *119 lua entry thread aborted: runtime error: /home/braga/tcp.lua:39: bad argument #1 to 'log' (bad log level: -1)
stack traceback:
coroutine 0:
[C]: in function 'log'
/home/braga/tcp.lua:39: in main chunk, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:35:51 [info] 2466480#0: *177 client 178.176.180.141:31580 connected to 0.0.0.0:4999
2026/03/09 11:36:01 [error] 2466480#0: *177 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:36:01 [notice] 2466480#0: *177 stream [lua] tcp.lua:52: Empty data, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:37:14 [info] 2468685#0: *1 client 178.176.180.141:60737 connected to 0.0.0.0:4999
2026/03/09 11:37:18 [info] 2468685#0: *3 client 178.176.180.141:26236 connected to 0.0.0.0:4999
2026/03/09 11:38:44 [info] 2468996#0: *1 client 178.176.180.141:4954 connected to 0.0.0.0:4999
2026/03/09 11:38:44 [notice] 2468996#0: *1 stream [lua] test.lua:1: Empty data, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:38:54 [error] 2468996#0: *1 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:38:54 [notice] 2468996#0: *1 stream [lua] test.lua:5: Empty data, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:39:18 [info] 2468996#0: *18 client 178.176.180.141:60644 connected to 0.0.0.0:4999
2026/03/09 11:39:20 [info] 2468996#0: *23 client 178.176.180.141:2437 connected to 0.0.0.0:4999
2026/03/09 11:39:33 [info] 2468996#0: *24 client 178.176.180.141:26739 connected to 0.0.0.0:4999
2026/03/09 11:39:43 [error] 2468996#0: *24 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:41:50 [info] 2468996#0: *56 client 178.176.180.141:54311 connected to 0.0.0.0:4999
2026/03/09 11:42:00 [error] 2468996#0: *56 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:42:33 [info] 2468996#0: *69 client 178.176.180.141:11042 connected to 0.0.0.0:4999
2026/03/09 11:42:43 [error] 2468996#0: *69 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:43:31 [info] 2468996#0: *85 client 178.176.180.141:64901 connected to 0.0.0.0:4999
2026/03/09 11:43:41 [info] 2468996#0: *89 client 178.176.180.141:56639 connected to 0.0.0.0:4999
2026/03/09 11:43:51 [error] 2468996#0: *89 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:44:10 [info] 2468996#0: *90 client 178.176.180.141:29772 connected to 0.0.0.0:4999
2026/03/09 11:44:20 [error] 2468996#0: *90 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:44:57 [info] 2468996#0: *106 client 178.176.180.141:62296 connected to 0.0.0.0:4999
2026/03/09 11:46:37 [error] 2468996#0: *106 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:04 [info] 2468996#0: *197 client 178.176.180.141:5252 connected to 0.0.0.0:4999
2026/03/09 11:47:04 [error] 2468996#0: *197 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:06 [info] 2468996#0: *199 client 178.176.180.141:57726 connected to 0.0.0.0:4999
2026/03/09 11:47:06 [error] 2468996#0: *199 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:07 [info] 2468996#0: *200 client 178.176.180.141:13730 connected to 0.0.0.0:4999
2026/03/09 11:47:07 [error] 2468996#0: *200 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:21 [info] 2468996#0: *206 client 178.176.180.141:5369 connected to 0.0.0.0:4999
2026/03/09 11:47:21 [error] 2468996#0: *206 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:22 [info] 2468996#0: *207 client 178.176.180.141:9303 connected to 0.0.0.0:4999
2026/03/09 11:47:22 [error] 2468996#0: *207 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:25 [info] 2468996#0: *208 client 178.176.180.141:25918 connected to 0.0.0.0:4999
2026/03/09 11:47:25 [error] 2468996#0: *208 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:26 [info] 2468996#0: *210 client 178.176.180.141:12467 connected to 0.0.0.0:4999
2026/03/09 11:47:26 [error] 2468996#0: *210 failed to load external Lua file "/home/braga/test.lua": /home/braga/test.lua:6: '=' expected near '::', client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:47:46 [info] 2468996#0: *219 client 178.176.180.141:54232 connected to 0.0.0.0:4999
2026/03/09 11:47:48 [error] 2468996#0: *219 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:48:50 [info] 2468996#0: *293 client 178.176.180.141:53075 connected to 0.0.0.0:4999
2026/03/09 11:48:52 [error] 2468996#0: *293 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:50:14 [info] 2468996#0: *301 client 178.176.180.141:10759 connected to 0.0.0.0:4999
2026/03/09 11:50:20 [info] 2468996#0: *304 client 178.176.180.141:6910 connected to 0.0.0.0:4999
2026/03/09 11:50:54 [info] 2468996#0: *309 client 178.176.180.141:25964 connected to 0.0.0.0:4999
2026/03/09 11:50:56 [error] 2468996#0: *309 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 11:52:41 [info] 2468996#0: *335 client 178.176.180.141:9889 connected to 0.0.0.0:4999
2026/03/09 11:52:43 [error] 2468996#0: *335 stream lua tcp socket read timed out, client: 178.176.180.141, server: 0.0.0.0:4999
2026/03/09 23:29:38 [info] 2753144#0: *1091 client 85.217.140.14:43406 connected to 0.0.0.0:4888
2026/03/10 02:46:02 [info] 2841169#0: *1 client 85.217.140.51:49768 connected to 0.0.0.0:4888
2026/03/10 10:08:49 [info] 3041451#0: *17 client 64.227.97.195:33214 connected to 0.0.0.0:4888
2026/03/10 10:09:23 [info] 3041961#0: *5 client 64.227.97.195:58028 connected to 0.0.0.0:4999
2026/03/10 17:31:55 [info] 3237341#0: *1178 client 146.158.80.124:64590 connected to 0.0.0.0:4999
2026/03/10 17:31:57 [error] 3237341#0: *1178 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:34:20 [info] 3237339#0: *1280 client 146.158.80.124:20893 connected to 0.0.0.0:4999
2026/03/10 17:34:22 [error] 3237339#0: *1280 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:34:26 [info] 3237339#0: *1285 client 146.158.80.124:11563 connected to 0.0.0.0:4999
2026/03/10 17:37:21 [info] 3237339#0: *1357 client 146.158.80.124:64621 connected to 0.0.0.0:4999
2026/03/10 17:37:23 [error] 3237339#0: *1357 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:37:35 [info] 3237339#0: *1360 client 146.158.80.124:48760 connected to 0.0.0.0:4999
2026/03/10 17:37:43 [info] 3237339#0: *1366 client 146.158.80.124:7387 connected to 0.0.0.0:4999
2026/03/10 17:42:38 [info] 3237339#0: *1475 client 146.158.80.124:48755 connected to 0.0.0.0:4999
2026/03/10 17:42:40 [error] 3237339#0: *1475 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:43:59 [info] 3237339#0: *1513 client 146.158.80.124:11334 connected to 0.0.0.0:4999
2026/03/10 17:45:07 [info] 3253714#0: *7 client 146.158.80.124:27716 connected to 0.0.0.0:4999
2026/03/10 17:45:09 [info] 3253714#0: *7 stream [lua] tcp.lua:43: decode(): 2<>(ÀE 1ðåÑ'ß, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:45:09 [notice] 3253714#0: *7 stream [lua] tcp.lua:57: null, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:45:30 [info] 3253714#0: *22 client 146.158.80.124:38027 connected to 0.0.0.0:4999
2026/03/10 17:45:31 [info] 3253714#0: *22 stream [lua] tcp.lua:43: decode(): {"room":{"humi":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"cellar":{"humi":77,"temp":14},"weather":{"humi":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:45:31 [notice] 3253714#0: *22 stream [lua] tcp.lua:57: {"cellar":{"humi":77,"temp":14},"room":{"humi":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"weather":{"humi":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:46:37 [info] 3253714#0: *51 client 146.158.80.124:11817 connected to 0.0.0.0:4999
2026/03/10 17:46:47 [error] 3253714#0: *51 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:46:47 [notice] 3253714#0: *51 stream [lua] tcp.lua:52: Empty data, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:46:53 [info] 3253714#0: *59 client 146.158.80.124:16831 connected to 0.0.0.0:4999
2026/03/10 17:46:55 [info] 3253714#0: *59 stream [lua] tcp.lua:43: decode(): {"cellar":{"humi":77,"temp":14},"room":{"humi":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"weather":{"humi":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 17:46:55 [notice] 3253714#0: *59 stream [lua] tcp.lua:57: {"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"cellar":{"humi":77,"temp":14},"room":{"humi":67,"temp":12},"id":"test","weather":{"humi":57,"temp":0}}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:06:10 [info] 3265223#0: *1 client 146.158.80.124:1664 connected to 0.0.0.0:4999
2026/03/10 18:06:20 [error] 3265223#0: *1 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:06:20 [notice] 3265223#0: *1 stream [lua] tcp.lua:67: Empty data, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:06:24 [info] 3265223#0: *5 client 146.158.80.124:11833 connected to 0.0.0.0:4999
2026/03/10 18:06:25 [info] 3265223#0: *5 stream [lua] tcp.lua:58: decode(): {"cellar":{"humi":77,"temp":14},"room":{"humi":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"weather":{"humi":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:06:25 [error] 3265223#0: *5 lua entry thread aborted: runtime error: /home/braga/tcp.lua:83: attempt to compare nil with number
stack traceback:
coroutine 0:
/home/braga/tcp.lua: in main chunk, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:06:34 [info] 3265223#0: *15 client 146.158.80.124:9568 connected to 0.0.0.0:4999
2026/03/10 18:06:36 [info] 3265223#0: *15 stream [lua] tcp.lua:58: decode(): {"cellar":{"humi":77,"temp":14},"room":{"humi":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"weather":{"humi":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:06:36 [error] 3265223#0: *15 lua entry thread aborted: runtime error: /home/braga/tcp.lua:83: attempt to compare nil with number
stack traceback:
coroutine 0:
/home/braga/tcp.lua: in main chunk, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:10:13 [info] 3265903#0: *6 client 146.158.80.124:8958 connected to 0.0.0.0:4999
2026/03/10 18:10:20 [info] 3265903#0: *16 client 146.158.80.124:35244 connected to 0.0.0.0:4999
2026/03/10 18:10:23 [info] 3265903#0: *16 stream [lua] tcp.lua:58: decode(): {"room":{"warm":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"cellar":{"warm":77,"temp":14},"weather":{"warm":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:10:23 [notice] 3265903#0: *16 stream [lua] tcp.lua:110: {"weather":{"date":"2026-03-10 18:10:23","warm":57,"warm_status":"is-success","temp_status":"is-success","temp":0},"cellar":{"date":"2026-03-10 18:10:23","warm":77,"warm_status":"is-success","temp_status":"is-warning","temp":14},"room":{"date":"2026-03-10 18:10:23","warm":67,"warm_status":"is-success","temp_status":"is-danger","temp":12},"id":"test","sensors":{"28:61:64:35:18:1E:74:EB":17,"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18}}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:10:23 [error] 3265903#0: *6 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:10:23 [notice] 3265903#0: *6 stream [lua] tcp.lua:67: Empty data, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:14:30 [info] 3266832#0: *6 client 146.158.80.124:33973 connected to 0.0.0.0:4999
2026/03/10 18:14:40 [error] 3266832#0: *6 stream lua tcp socket read timed out, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:14:40 [notice] 3266832#0: *6 stream [lua] tcp.lua:67: Empty data, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:14:44 [info] 3266835#0: *10 client 146.158.80.124:23310 connected to 0.0.0.0:4999
2026/03/10 18:14:45 [info] 3266835#0: *10 stream [lua] tcp.lua:58: decode(): {"room":{"warm":67,"temp":12},"sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"cellar":{"warm":77,"temp":14},"weather":{"warm":57,"temp":0},"id":"test"}, client: 146.158.80.124, server: 0.0.0.0:4999
2026/03/10 18:14:45 [notice] 3266835#0: *10 stream [lua] tcp.lua:113: {"room":{"warm":67,"warm_status":"is-success","temp_status":"is-danger","date":"2026-03-10 18:14:45","temp":12},"id":"test","sensors":{"28:61:64:35:18:3C:3D:61":19,"28:61:64:34:80:10:F4:39":18,"28:61:64:35:18:1E:74:EB":17},"cellar":{"warm":77,"warm_status":"is-success","temp_status":"is-warning","date":"2026-03-10 18:14:45","temp":14},"weather":{"warm":57,"warm_status":"is-success","temp_status":"is-success","date":"2026-03-10 18:14:45","temp":0}}, client: 146.158.80.124, server: 0.0.0.0:4999

View File

@ -0,0 +1 @@
<!DOCTYPE html><html lang="de"><head><meta name="description" content="Textverarbeitung, Präsentationen und Tabellen im Web"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"><link rel="shortcut icon" href="//docs.google.com/favicon.ico"><title>Seite nicht gefunden</title><meta name="referrer" content="strict-origin-when-cross-origin"><link href="//fonts.googleapis.com/css?family=Product+Sans" rel="stylesheet" type="text/css" nonce="qKOpCCtG9YE5jr-jLswn9Q"><style nonce="qKOpCCtG9YE5jr-jLswn9Q">.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}#drive-logo{margin:18px 0;position:absolute;white-space:nowrap}.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_116x41dp.png);-webkit-background-size:116px 41px;background-size:116px 41px;display:inline-block;height:41px;vertical-align:bottom;width:116px}.docs-drivelogo-text{color:#000;display:inline-block;opacity:.54;text-decoration:none;font-family:"Product Sans",Arial,Helvetica,sans-serif;font-size:32px;text-rendering:optimizeLegibility;position:relative;top:-6px;left:-7px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:144dpi){.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/2x/googlelogo_color_116x41dp.png)}}sentinel{}</style><style type="text/css" nonce="qKOpCCtG9YE5jr-jLswn9Q">body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}</style><style type="text/css" nonce="qKOpCCtG9YE5jr-jLswn9Q">.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}</style></head><body><div id="outerContainer"><div id="innerContainer"><div style="position: absolute; top: -80px;"><div style="margin: 18px 0; position: absolute; white-space: nowrap;"><a href="//support.google.com/docs/"><img height="35px" src="//ssl.gstatic.com/docs/common/product/spreadsheets_lockup2.png" alt="Google-Logo"/></a></div></div><div align="center"><p class="errorMessage" style="padding-top: 50px">Datei kann derzeit nicht geöffnet werden.</p><p> Überprüfen Sie die Adresse und versuchen Sie es erneut.</p><div style="background: #F0F6FF; border: 1px solid black; margin-top: 35px; padding: 10px 125px; width: 300px;"><p><strong>Mit Google Drive mehr erledigen </strong></p><p>Mit den Apps in Google Drive können Sie Dokumente, Tabellen, Präsentationen und vieles mehr problemlos online erstellen, speichern und freigeben.</p><p>Weitere Informationen finden Sie hier: <a href="https://drive.google.com/start/apps">drive.google.com/start/apps</a>.</p></div></div></div></div></body><style nonce="qKOpCCtG9YE5jr-jLswn9Q">html {height: 100%; overflow: auto;}body {height: 100%; overflow: auto;}#outerContainer {margin: auto; max-width: 750px;}#innerContainer {margin-bottom: 20px; margin-left: 40px; margin-right: 40px; margin-top: 80px; position: relative;}</style></html>

68
tcp.lua
View File

@ -3,6 +3,21 @@ local base64 = require('base64')
local flatdb = require('database.flatdb') local flatdb = require('database.flatdb')
local db = flatdb('/home/braga/database') local db = flatdb('/home/braga/database')
if not db.cellar then
db.cellar = {{temp=0, date = os.date('%Y-%m-%d %H:%M:%S'), warm=0, warm_status='is-danger',temp_status='is-warning'}}
db:save()
end
if not db.weather then
db.weather = {{temp=0, date = os.date('%Y-%m-%d %H:%M:%S'), warm=0, warm_status='is-success',temp_status='is-success'}}
db:save()
end
if not db.room then
db.room = {{temp=0, date = os.date('%Y-%m-%d %H:%M:%S'), warm=0, warm_status='is-danger',temp_status='is-warning'}}
db:save()
end
local limits = { local limits = {
weather = { weather = {
temp = { temp = {
@ -44,23 +59,58 @@ local function decode(rec)
return json.decode(rec) return json.decode(rec)
end end
local sock = assert(ngx.req.socket(true),'no socket') local sock = ngx.req.socket(true)
sock:settimeout(10000) -- one second timeout sock:settimeout(10000) -- one second timeout
local rec = sock:receive() -- read a line from downstream local rec = sock:receive() -- read a line from downstream
if rec == nil then if rec == nil then
ngx.log(ngx.NOTICE, 'Empty data') ngx.log(ngx.NOTICE, 'Empty data')
return ngx.exit(444) return ngx.exit(444)
else else
rec = decode(rec) rec = decode(rec)
local res = db.add({['guid']=rec.id,['type']='bme',['alt']=rec.bme.alt,['temp']=rec.bme.temp,['press']=rec.bme.press}) if rec.sensors then
ngx.log(ngx.NOTICE, res) for id,temp in pairs(rec.sensors) do
res = db.add({['guid']=rec.id,['type']='dht',['humi']=rec.dht.humi,['temp']=rec.dht.temp}) if not db[id] then db[id] = {} end
ngx.log(ngx.NOTICE, res) table.insert(db[id],{temp=temp, date=os.date('%Y-%m-%d %H:%M:%S')})
res = db.add({['guid']=rec.id,['type']='solar',['uf']=rec.uf}) end
ngx.log(ngx.NOTICE, res) else
sock:send(base64.encode(json.encode(rec))) ngx.log(ngx.NOTICE, 'не получены данные с сенсоров')
end
if rec.cellar and rec.cellar.temp then
rec.cellar.warm = rec.cellar.warm or 0
if rec.cellar.temp >= limits.cellar.temp.optimal[1] and rec.cellar.temp <= limits.cellar.temp.optimal[2] then rec.cellar.temp_status = 'is-success'
elseif rec.cellar.temp >= limits.cellar.temp.critical[1] and rec.cellar.temp <= limits.cellar.temp.critical[2] then rec.cellar.temp_status = 'is-warning'
else rec.cellar.temp_status = 'is-danger' end
if rec.cellar.warm >= limits.cellar.warm.optimal[1] and rec.cellar.warm <= limits.cellar.warm.optimal[2] then rec.cellar.warm_status = 'is-success'
elseif rec.cellar.warm >= limits.cellar.warm.critical[1] and rec.cellar.warm <= limits.cellar.warm.critical[2] then rec.cellar.warm_status = 'is-warning'
else rec.cellar.warm_status = 'is-danger' end
rec.cellar.date = os.date('%Y-%m-%d %H:%M:%S')
table.insert(db.cellar,rec.cellar)
end
if rec.room and rec.room.temp then
rec.room.warm = rec.room.warm or 0
if rec.room.temp >= limits.room.temp.optimal[1] and rec.room.temp <= limits.room.temp.optimal[2] then rec.room.temp_status = 'is-success'
elseif rec.room.temp >= limits.room.temp.critical[1] and rec.room.temp <= limits.room.temp.critical[2] then rec.room.temp_status = 'is-warning'
else rec.room.temp_status = 'is-danger' end
if rec.room.warm >= limits.room.warm.optimal[1] and rec.room.warm <= limits.room.warm.optimal[2] then rec.room.warm_status = 'is-success'
elseif rec.room.warm >= limits.room.warm.critical[1] and rec.room.warm <= limits.room.warm.critical[2] then rec.room.warm_status = 'is-warning'
else rec.room.warm_status = 'is-danger' end
rec.room.date = os.date('%Y-%m-%d %H:%M:%S')
table.insert(db.room,rec.room)
end
if rec.weather and rec.weather.temp then
rec.weather.warm = rec.weather.warm or 0
if rec.weather.temp >= limits.weather.temp.optimal[1] and rec.weather.temp <= limits.weather.temp.optimal[2] then rec.weather.temp_status = 'is-success'
elseif rec.weather.temp >= limits.weather.temp.critical[1] and rec.weather.temp <= limits.weather.temp.critical[2] then rec.weather.temp_status = 'is-warning'
else rec.weather.temp_status = 'is-danger' end
if rec.weather.warm >= limits.weather.warm.optimal[1] and rec.weather.warm <= limits.weather.warm.optimal[2] then rec.weather.warm_status = 'is-success'
elseif rec.weather.warm >= limits.weather.warm.critical[1] and rec.weather.warm <= limits.weather.warm.critical[2] then rec.weather.warm_status = 'is-warning'
else rec.weather.warm_status = 'is-danger' end
rec.weather.date = os.date('%Y-%m-%d %H:%M:%S')
table.insert(db.weather,rec.weather)
end
db:save() db:save()
ngx.log(ngx.NOTICE, json.encode(rec))
sock:send('OK')
end end

10
test.lua Normal file
View File

@ -0,0 +1,10 @@
local sock = ngx.req.socket(true)
sock:settimeout(2000) -- one second timeout
local line, err, partial = sock:receive()
if not line then
ngx.say("failed to read a line: ", err)
--sock::close()
return
end
ngx.say("successfully read a line: ", line)