Skip to content

Commit

Permalink
Fill temperature values with zeros
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
misery committed May 23, 2021
1 parent df47e40 commit 2e077eb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e077eb

Please sign in to comment.