hottisScd30
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Wolfgang Hottgenroth 2024-01-07 18:23:22 +01:00
parent 766355f85d
commit f55990cc57
Signed by: wn
GPG Key ID: 836E9E1192A6B132

View File

@ -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
} }