|
|
|
@ -2,6 +2,7 @@ package mqtt
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"math"
|
|
|
|
"reflect"
|
|
|
|
"reflect"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
@ -47,9 +48,9 @@ func eventToMap(event *weather.AmbientEntry) map[string]string {
|
|
|
|
case uint, uint8, uint16, uint32, uint64:
|
|
|
|
case uint, uint8, uint16, uint32, uint64:
|
|
|
|
v = strconv.FormatUint(f.Uint(), 10)
|
|
|
|
v = strconv.FormatUint(f.Uint(), 10)
|
|
|
|
case float32:
|
|
|
|
case float32:
|
|
|
|
v = strconv.FormatFloat(f.Float(), 'f', 4, 32)
|
|
|
|
v = strconv.FormatFloat(math.Round(f.Float()*10)/10, 'f', 4, 32)
|
|
|
|
case float64:
|
|
|
|
case float64:
|
|
|
|
v = strconv.FormatFloat(f.Float(), 'f', 4, 64)
|
|
|
|
v = strconv.FormatFloat(math.Round(f.Float()*10)/10, 'f', 4, 64)
|
|
|
|
case []byte:
|
|
|
|
case []byte:
|
|
|
|
v = string(f.Bytes())
|
|
|
|
v = string(f.Bytes())
|
|
|
|
case string:
|
|
|
|
case string:
|
|
|
|
|