Is your feature request related to a problem? Please describe.
Support new tedge telemetry type called twin (in Cumulocity IoT this is called inventory managed object updates) to add json data to the device, child device or service's digital twin in the Cloud.
Describe the solution you'd like
New topic following the tedge MQTT V1 interface to allow users to publish additional information to the entity (e.g. device, child device or service).
Topic name
te/{identity}/twin/<type>
Payload (json, retain=true)
{
"family": "Debian",
"version": 11
}
MQTT messages published to te/{identity}/twin/<type> should be published with the retained flag to allow other components to more easily observe the information.
Cloud mapper initialization (to be validated)
When the tedge-mapper starts up for a given cloud, it should run the following routine to process the initial values after any registration process has finished:
Read the inventory.json file, load the values into an in-memory model
Subscribe to the data topic using the MQTT topic pattern {identifier}/twin/+ and merge the results. The values received via MQTT take precedence over any duplicated values from the inventory.json file
Publish the inventory changes to the relevant cloud in one message (if possible)
Process all subsequent messages received on the {identifier}/twin/+ MQTT topic as single message to the relevant cloud
Open questions
How to handle inventory.json? Previously the inventory.json file was used to publish static information to the cloud, however it was not that useful as it would only be read on startup and it also required users to have file access to the file (amongst other limitations).
Option 1: Deprecate the inventory.json file. Use a feature flag to deactivate/ignore the file.
Option 2: Use the inventory.json value as the persistence layer. Any messages published to the /data/ topics will be merged into the inventory.json before publishing
Describe alternatives you've considered
Additional context
A draft PR has already been created to include the following items to assist with the development:
Documentation about tedge topic to c8y mapping for the new /twin/ topic
Is your feature request related to a problem? Please describe.
Support new tedge telemetry type called
twin
(in Cumulocity IoT this is called inventory managed object updates) to add json data to the device, child device or service's digital twin in the Cloud.Describe the solution you'd like
New topic following the tedge MQTT V1 interface to allow users to publish additional information to the entity (e.g. device, child device or service).
Topic name
Payload (json, retain=true)
MQTT messages published to
te/{identity}/twin/<type>
should be published with the retained flag to allow other components to more easily observe the information.Cloud mapper initialization (to be validated)
When the tedge-mapper starts up for a given cloud, it should run the following routine to process the initial values after any registration process has finished:
{identifier}/twin/+
and merge the results. The values received via MQTT take precedence over any duplicated values from the inventory.json file{identifier}/twin/+
MQTT topic as single message to the relevant cloudOpen questions
/data/
topics will be merged into the inventory.json before publishingDescribe alternatives you've considered
Additional context
A draft PR has already been created to include the following items to assist with the development:
/twin/
topicRelated tickets