thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

Sync entities on the cloud with local entity store on mapper startup

Open albinsuresh opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

Currently when the mapper starts, it requests for the list of all the child devices of the main device and if any additional child devices are known locally, those are registered with the cloud. But, if the cloud list contained any additional child devices that were not know locally, they are just ignored. This syncing should work both ways.

Currently, only the immediate child devices of the tedge device is synced. This sync must be extended to nested child devices and services as well.

Describe the solution you'd like

When the child list received from the cloud contains more devices than what's known locally, auto-register those child devices with the entity store by publishing auto-registration messages to the broker.

Additional context

SmartREST template 105 is already used to fetch child device list of a main device. But such SmartREST template does not exist to retrieve the list of services on the device. We should either request for such a template from C8y or find some other mechanism. If no such mechanism over MQTT exists, the childAdditions of the device (used to represent services) can be retrieved using HTTP. But, it might require the knowledge of the c8y_internal_id of all devices as well, which would be tricky to manage.

albinsuresh avatar Oct 05 '23 05:10 albinsuresh