hottisScd30
This commit is contained in:
parent
766355f85d
commit
f55990cc57
@ -17,7 +17,7 @@ type hottisScd30Values struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]database.VariableType, _ *map[string]interface{}, _ *database.Device) error {
|
func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]database.VariableType, attributes *map[string]interface{}, _ *database.Device) error {
|
||||||
if fPort != 2 {
|
if fPort != 2 {
|
||||||
return fmt.Errorf("Unexpected fPort %d", fPort)
|
return fmt.Errorf("Unexpected fPort %d", fPort)
|
||||||
}
|
}
|
||||||
@ -37,5 +37,25 @@ func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]databas
|
|||||||
var humidity float32 = float32(values.Hum) / 100;
|
var humidity float32 = float32(values.Hum) / 100;
|
||||||
log.Printf("CO2: %f, Temp: %f, Hum: %f, Status: %d", co2concentration, temperature, humidity, values.Status)
|
log.Printf("CO2: %f, Temp: %f, Hum: %f, Status: %d", co2concentration, temperature, humidity, values.Status)
|
||||||
|
|
||||||
|
(*variables)["co2concentration"] = database.VariableType {
|
||||||
|
Label: "co2concentration",
|
||||||
|
Variable: "concentration",
|
||||||
|
Unit: "ppm",
|
||||||
|
Value: co2concentration,
|
||||||
|
}
|
||||||
|
(*variables)["temperature"] = database.VariableType {
|
||||||
|
Label: "temperature",
|
||||||
|
Variable: "temperature",
|
||||||
|
Unit: "°C",
|
||||||
|
Value: temperature,
|
||||||
|
}
|
||||||
|
(*variables)["humidity"] = database.VariableType {
|
||||||
|
Label: "humidity",
|
||||||
|
Variable: "humidity",
|
||||||
|
Unit: "%",
|
||||||
|
Value: humidity,
|
||||||
|
}
|
||||||
|
|
||||||
|
(*attributes)["Status"] = values.Status
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user