Skip to content

Commit 15dbec6

Browse files
authored
Implement LocalServer. A simple http server that collects and plots iSpindel data. (#632)
* Implement LocalServer. A simple http server written in Golang that collects and plots iSpindel data on local network. * Filter non alpha numerical characters from filename.
1 parent 31e785e commit 15dbec6

File tree

7 files changed

+998
-0
lines changed

7 files changed

+998
-0
lines changed

tools/LocalServer/Readme.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Local Server
2+
3+
This server collects and plot data for iSpindel on LAN.
4+
5+
Since this simple server uses HTTP, do NOT expose it to the public network!
6+
7+
It can be run simply with `Golang` build environment installed via `go run .`
8+
9+
An optional `-p` flag can be used to specify the port to run on (Default is `8080`).
10+
11+
E.g. `go run . -p 9000`
12+
13+
Configure the iSpindel with the following settings:
14+
15+
* Method: HTTP
16+
* Host: your local server IP
17+
* Port: port you are running on (default 8080)
18+
* Path: /data
19+
20+
You can run this in a tmux, or as a service.
21+
22+
Data collected are saved as `.csv` under `.../LocalServer/data/<ispindel_name>.csv`.
23+
Therefore changing the device name would start a new save file.
24+
25+
Author: kaihuang201

tools/LocalServer/data/SpinHydro.csv

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
timestamp,gravity,angle,temperature,temp_units,battery,interval,name,ID,RSSI,token
2+
2025-02-11 18:59:19,1.05,74.48,27.81,C,4.10,1800,SpinHydro,6548473,-56,
3+
2025-02-11 19:28:30,1.051,74.099,28.188,C,4.098,1800,SpinHydro,6548473,-50,
4+
2025-02-11 19:57:40,1.046,73.517,28.312,C,4.098,1800,SpinHydro,6548473,-50,
5+
2025-02-11 20:26:50,1.046,73.513,28.312,C,4.098,1800,SpinHydro,6548473,-49,
6+
2025-02-11 20:55:58,1.044,73.378,28.375,C,4.098,1800,SpinHydro,6548473,-49,
7+
2025-02-11 21:25:08,1.043,73.142,28.375,C,4.098,1800,SpinHydro,6548473,-47,

tools/LocalServer/data/calibration.csv

+382
Large diffs are not rendered by default.

tools/LocalServer/go.mod

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module testserver
2+
3+
go 1.16
4+
5+
require (
6+
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2
7+
github.com/fatih/color v1.13.0 // indirect
8+
github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 // indirect
9+
)

tools/LocalServer/go.sum

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 h1:ZBbLwSJqkHBuFDA6DUhhse0IGJ7T5bemHyNILUjvOq4=
2+
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2/go.mod h1:VSw57q4QFiWDbRnjdX8Cb3Ow0SFncRw+bA/ofY6Q83w=
3+
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
4+
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
5+
github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 h1:nqAlWFEdqI0ClbTDrhDvE/8LeQ4pftrqKUX9w5k0j3s=
6+
github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI=
7+
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
8+
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
9+
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
10+
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
11+
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
12+
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
13+
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
14+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
15+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

0 commit comments

Comments
 (0)