Compare commits

..

2 Commits

Author SHA1 Message Date
6f9327fdd6 sensor labels
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-07-31 16:36:17 +02:00
1d1942a4d3 sensor labels 2024-07-31 16:26:51 +02:00

View File

@ -31,8 +31,9 @@ func getSensorName(sensorsMap *map[string]string, sensorAddress uint64) string {
} }
func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]database.VariableType, attributes *map[string]interface{}, device *database.Device) error { func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]database.VariableType, attributes *map[string]interface{}, device *database.Device) error {
deviceAttrs := (*device).Attributes
sensorsMap := make(map[string]string) sensorsMap := make(map[string]string)
sensorsJSON, ok := (*device).Attributes["Sensors"].(string) sensorsJSON, ok := deviceAttrs["Sensors"].(string)
if !ok { if !ok {
return fmt.Errorf("Unable to load sensor map from attributes") return fmt.Errorf("Unable to load sensor map from attributes")
} }