From 68ab2e205b001431211681239480e056a9bb99f6 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Wed, 14 Apr 2021 19:50:37 +0200 Subject: [PATCH] vbat percentage calculation adopted --- check_nodes/main.go | 6 +++--- metrics.go | 2 +- snippets/index.html | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/check_nodes/main.go b/check_nodes/main.go index e896682..ae4d7df 100644 --- a/check_nodes/main.go +++ b/check_nodes/main.go @@ -269,8 +269,8 @@ func vbat2percent(vbat string) int { i, err := strconv.Atoi(vbat) res := 0 if err == nil { - res = int(float64(i-3500) * float64((100.0/0.7)*0.001)) - //fmt.Printf("vbat2percent Result in Percent: %d\n", res) + res = int(float64(i-3400) / 6.0) + fmt.Printf("vbat2percent Result in Percent: %d\n", res) if res < 0 { res = 0 } else if res > 100 { @@ -399,7 +399,7 @@ func main() { if last_metric.BatteryPercent != "" { fmt.Printf("%s:%s:%s Percent:%s:%d\n", u2, d, last_metric.BatteryPercent, last_metric.ActiveUntil, last_metric.DaysUntilDeactivated) vp, _ := strconv.Atoi(last_metric.BatteryPercent) - if CheckThreshold(d, vp, u2, last_metric, 50, 20, 10) { + if CheckThreshold(d, vp, u2, last_metric, 20, 10, 5) { DeleteAlert("alarm_sent_accu:", d, u2) } } diff --git a/metrics.go b/metrics.go index 94ecabc..a7b1fa2 100644 --- a/metrics.go +++ b/metrics.go @@ -333,7 +333,7 @@ func vbat2percent(vbat string) int { i, err := strconv.Atoi(vbat) res := 0 if err == nil { - res = int(float64(i-3500) * float64((100.0/0.7)*0.001)) + res = int(float64(i-3400) / 6.0) fmt.Printf("vbat2percent Result in Percent: %d\n", res) if res < 0 { res = 0 diff --git a/snippets/index.html b/snippets/index.html index 458b8a0..9d9a592 100644 --- a/snippets/index.html +++ b/snippets/index.html @@ -1,6 +1,7 @@ {{define "header_additions"}} {{end}} {{define "body_content"}} +

Willkommen bei wo-bisch.ch

Hier sind Sie am richtigen Ort, wenn Sie einen kleinen, sparsamen GPS-Tracker suchen, der seinen Standort periodisch übermittelt.