fix(gateway): update field handling to include value type
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -85,11 +85,12 @@ func (gh *Gateway) requestInflux(c *gin.Context) error {
|
||||
field := record.Field()
|
||||
value := record.Value()
|
||||
m["time"] = record.Time()
|
||||
m["value"] = value.(float64)
|
||||
if field == "temperature" {
|
||||
m["temperature"] = value.(float64)
|
||||
m["type"] = "temperature"
|
||||
}
|
||||
if field == "humidity" {
|
||||
m["humidity"] = value.(float64)
|
||||
m["type"] = "humidity"
|
||||
}
|
||||
values = append(values, m)
|
||||
fmt.Println(results.Record())
|
||||
|
||||
Reference in New Issue
Block a user