|
@@ -51,8 +51,10 @@ func (jp jsonParser) Measure() (*Measurement, error) {
|
|
|
return nil, err
|
|
|
}
|
|
|
if len(jsonPacket.Model) > 0 {
|
|
|
- fmt.Printf("Model: %s, ID:%d, Temperature:%f \n", jsonPacket.Model, jsonPacket.ID, jsonPacket.Temperature_C)
|
|
|
- return &Measurement{ID: jsonPacket.ID, Temperature: jsonPacket.Temperature_C}, nil
|
|
|
+ batteryGood := strings.Compare(jsonPacket.Battery, "OK") == 0
|
|
|
+ fmt.Printf("Model: %s, ID:%d, Temperature:%f, Battery good: %t\n", jsonPacket.Model, jsonPacket.ID, jsonPacket.Temperature_C, batteryGood)
|
|
|
+
|
|
|
+ return &Measurement{ID: jsonPacket.ID, Temperature: jsonPacket.Temperature_C, BatteryGood: batteryGood}, nil
|
|
|
}
|
|
|
}
|
|
|
return nil, nil
|