sensor labels
This commit is contained in:
@ -31,10 +31,11 @@ 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: %s", (*device).Attributes)
|
return fmt.Errorf("Unable to load sensor map from attributes")
|
||||||
}
|
}
|
||||||
errJ := json.Unmarshal([]byte(sensorsJSON), &sensorsMap)
|
errJ := json.Unmarshal([]byte(sensorsJSON), &sensorsMap)
|
||||||
if errJ != nil {
|
if errJ != nil {
|
||||||
|
Reference in New Issue
Block a user