battery
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
|
||||
type hottisThreeWayThermometerValues struct {
|
||||
Status uint8
|
||||
// Battery uint16
|
||||
Battery uint16
|
||||
SensorAddress1 uint64
|
||||
Value1 int32
|
||||
SensorAddress2 uint64
|
||||
@ -37,16 +37,24 @@ func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]databas
|
||||
return fmt.Errorf("Unable to cast into struct: %v", err)
|
||||
}
|
||||
|
||||
var battery float32 = float32(values.Battery) / 1000.0
|
||||
var value1 float32 = float32(values.Value1) / 128.0
|
||||
var value2 float32 = float32(values.Value2) / 128.0
|
||||
var value3 float32 = float32(values.Value3) / 128.0
|
||||
|
||||
//log.Printf("Status: %d, Battery: %d", values.Status, values.Battery);
|
||||
log.Printf("Status: %d", values.Status);
|
||||
log.Printf("Battery: %d, %f", values.Battery, battery);
|
||||
log.Printf("Sensor1: Addr: %d, Value: %f", values.SensorAddress1, value1);
|
||||
log.Printf("Sensor2: Addr: %d, Value: %f", values.SensorAddress2, value2);
|
||||
log.Printf("Sensor3: Addr: %d, Value: %f", values.SensorAddress3, value3);
|
||||
|
||||
(*variables)["Battery"] = database.VariableType {
|
||||
Label: "Battery",
|
||||
Variable: "Voltage",
|
||||
Unit: "V",
|
||||
Value: battery,
|
||||
}
|
||||
(*variables)["Temperature1"] = database.VariableType {
|
||||
Label: "Temperature1",
|
||||
Variable: "Temperature",
|
||||
|
Reference in New Issue
Block a user