edgexfoundry / device-sdk-go

Owner: Device WG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Device service PUT handling: wrong value published on MessageBus when DataTransform is used

rst2071 opened this issue Β· comments

🐞 Bug Report

Affected Services [REQUIRED]

Core Command/Command Request/Set Command
The issue is located in: device-sdk-go handling of the PUT /device/name/{device}/{command}, publishing an update to the MessageBus.

Is this a regression?

No.

Description and Minimal Reproduction [REQUIRED]

Writing a scaled value with the command request/set, the write-scale transformed value is published on the message bus.

For example:
Write request: Setpoint=10 (device profile: scale=0.1)
Result: Write value issued on device is correct (100), but the same 100 is published also on the message bus, which is not correct.

πŸ”₯ Exception or Error

n/a

🌍 Your Environment

Deployment Environment:
n/a

EdgeX Version [REQUIRED]:
Napa 3.1.0

Anything else relevant?
In command.go:323, dataTransform is always disabled by passing false as 4th parameter. Since the command value cv is already write-transformed (line 308), this causes the problem.

// Updated resource value will be published to MessageBus as long as it's not write-only
	if dr.Properties.ReadWrite != common.ReadWrite_W {
		return transformer.CommandValuesToEventDTO([]*sdkModels.CommandValue{cv}, device.Name, resourceName, false, dic)
	}

We're currently experiencing the same problem described above, and we're keen to know if there have been any recent updates or progress toward resolving it. If there's any way we can contribute to the resolution process, please let us know.