thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

Set the name of the 'main' Device #3055

Open ButKor opened 2 months ago

ButKor commented 2 months ago

Is your feature improvement request related to a problem? Please describe. I would like to use a serial-number as my technical device-id, but use a different/more meaningful name for the Device in Cumulocity. For child-devices and services this works perfectly fine with specifying different @id and name fields in the registration messages. But I can't find a way to do the same for the main-device - here it always uses the CN of the certificate. Once registered, thin-edge.io disallows to set the name via the tedge mqtt pub "te/device/main///twin/name" or the /etc/tedge/device/inventory.json (as documented here)

Describe the solution you'd like I would like to be able to set a different name than ID for a main device, e.g. via a new tedge config field device.name in same manner as done with device.type.

Describe alternatives you've considered Tried setting the name via:

rina23q commented 2 months ago

I would add additional implementation context.

The 100 message is sent during tedge connect c8y. The second field is using device_id (= the same name as the device certificate's CN), although device_type is already configurable as device.type in tedge config. https://github.com/thin-edge/thin-edge.io/blob/193ac915eecec1734f8770b113d11a5e38df46cf/crates/core/tedge/src/cli/connect/c8y_direct_connection.rs#L146

So, the implementation should be straight-forward.