Observe, that the measurement is published to Cumulocity, but without any child device registration, making Cumulocity complain on c8y/error:
$ tedge mqtt sub 'c8y/#'
INFO: Connected
[c8y/measurement/measurements/create] {"externalSource":{"externalId":"demo-device-888:device:ghost_child","type":"c8y_Serial"},"value":{"value":{"value":1.0}},"time":"2024-02-22T17:22:22.655401232Z","type":"ThinEdgeMeasurement"}
[c8y/error] {"messageId":182,"error":"general/internalError","message":"Current device is not the owner of the given source null","info":"https://cumulocity.com/guides/reference/rest-implementation/#a-name-error-reporting-a-error-reporting"}
Expected behavior
A registration message must be sent for the child-device before is sent its first telemetry data or capability message. Cumulocity should not complain on c8y/error.
Describe the bug
If the very first message sent by a child device is ill-formed, then:
To Reproduce
Prerequisite: a name for a new child device that is known neither by thin-edge nor Cumulocity. Here, I used
ghost_child
Be ready to observe messages sent to Cumulocity:
Send a first ill-formed measurement on -behalf of the new child device:
Observe, that as expected, nothing is sent to Cumulocity.
Now send a correct measurement on-behalf of the child device:
Observe, that the measurement is published to Cumulocity, but without any child device registration, making Cumulocity complain on
c8y/error
:Expected behavior
A registration message must be sent for the child-device before is sent its first telemetry data or capability message. Cumulocity should not complain on
c8y/error
.Screenshots
Environment (please complete the following information):
Additional context
This bug has been introduced by https://github.com/thin-edge/thin-edge.io/pull/2169 (my bad) and a unit test (which is currently ignored) is already here: https://github.com/thin-edge/thin-edge.io/blob/main/crates/extensions/c8y_mapper_ext/src/converter.rs#L2058