Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

fix issue 16:some items in deviceProperties do not have value #20

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion clients/edgex-foundry/device_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,19 @@ func (efc *EdgexDeviceClient) ListPropertiesState(ctx context.Context, device *d
klog.V(5).ErrorS(err, "failed to decode the response ", "response", resp)
continue
}
actualValue := getPropertyValueFromEvent(c.Name, event)
readingName := c.Name
getResp := c.Get.Responses
for _, it := range getResp {
if it.Code == "200" {
expectValues := it.ExpectedValues
if len(expectValues) == 1 {
readingName = expectValues[0]
}
}
}
klog.V(5).Infof("get reading name %s for command %s of device %s", readingName, c.Name, device.Name)
actualValue := getPropertyValueFromEvent(readingName, event)

aps[c.Name] = devicev1alpha1.ActualPropertyState{Name: c.Name, GetURL: c.Get.URL, ActualValue: actualValue}
}
}
Expand Down