Skip to content

Commit

Permalink
Implement LocalServer. A simple http server that collects and plots i…
Browse files Browse the repository at this point in the history
…Spindel 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.
  • Loading branch information
kaihuang201 authored Feb 12, 2025
1 parent 31e785e commit 15dbec6
Show file tree
Hide file tree
Showing 7 changed files with 998 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/LocalServer/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Local Server

This server collects and plot data for iSpindel on LAN.

Since this simple server uses HTTP, do NOT expose it to the public network!

It can be run simply with `Golang` build environment installed via `go run .`

An optional `-p` flag can be used to specify the port to run on (Default is `8080`).

E.g. `go run . -p 9000`

Configure the iSpindel with the following settings:

* Method: HTTP
* Host: your local server IP
* Port: port you are running on (default 8080)
* Path: /data

You can run this in a tmux, or as a service.

Data collected are saved as `.csv` under `.../LocalServer/data/<ispindel_name>.csv`.
Therefore changing the device name would start a new save file.

Author: kaihuang201
7 changes: 7 additions & 0 deletions tools/LocalServer/data/SpinHydro.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
timestamp,gravity,angle,temperature,temp_units,battery,interval,name,ID,RSSI,token
2025-02-11 18:59:19,1.05,74.48,27.81,C,4.10,1800,SpinHydro,6548473,-56,
2025-02-11 19:28:30,1.051,74.099,28.188,C,4.098,1800,SpinHydro,6548473,-50,
2025-02-11 19:57:40,1.046,73.517,28.312,C,4.098,1800,SpinHydro,6548473,-50,
2025-02-11 20:26:50,1.046,73.513,28.312,C,4.098,1800,SpinHydro,6548473,-49,
2025-02-11 20:55:58,1.044,73.378,28.375,C,4.098,1800,SpinHydro,6548473,-49,
2025-02-11 21:25:08,1.043,73.142,28.375,C,4.098,1800,SpinHydro,6548473,-47,
382 changes: 382 additions & 0 deletions tools/LocalServer/data/calibration.csv

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tools/LocalServer/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module testserver

go 1.16

require (
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2
github.com/fatih/color v1.13.0 // indirect
github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 // indirect
)
15 changes: 15 additions & 0 deletions tools/LocalServer/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 h1:ZBbLwSJqkHBuFDA6DUhhse0IGJ7T5bemHyNILUjvOq4=
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2/go.mod h1:VSw57q4QFiWDbRnjdX8Cb3Ow0SFncRw+bA/ofY6Q83w=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 h1:nqAlWFEdqI0ClbTDrhDvE/8LeQ4pftrqKUX9w5k0j3s=
github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Loading

0 comments on commit 15dbec6

Please sign in to comment.