From 2e077ebcebed1c4455d924b21f61a64ca6bff105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Sun, 23 May 2021 22:38:43 +0200 Subject: [PATCH] Fill temperature values with zeros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If someone wants to set 23.00 °C and send "23" we need to fill it to "2300". Otherwise EnergyLogic uses it as 0.23 °C. --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 393e626..5495a29 100644 --- a/main.go +++ b/main.go @@ -146,6 +146,9 @@ func fetch(ip string, values []string, prefix string) content { func propagate(bridge *bridgeCfg, name string, value string, prefix string) bool { if stringSuffixInSlice(name, roomFieldsTemperature) { value = strings.Replace(value, ".", "", -1) + for i := len(value); i < 4; i++ { + value += "0" + } } data := prefix + "." + name + "=" + url.QueryEscape(value)