SoftwareAG/cumulocity-python-api

DeviceGroup class should remove method .add_child_device(), which is confusing and also leads to incorrect behaviors

Opened this issue · 1 comments

Method .add_child_device() should be removed from DeviceGroup, as DeviceGroup uses .add_child_asset() to associate a device with the group. Using DeviceGroup.add_child_device() for this purpose is very confusing and the results seems also incorrect as stated in below issue 1.

Issue 1.

  • when use DeviceGroup.add_child_device(), the added device is not shown in the group from the tenant. However, deleting the group and its assets will also delete the device. This is very confusing.

Issue 2.

  • After execute DeviceGroup.add_child_asset(), the attributes of the DeviceGroup .child_assets are still empty, which seems not right.

I agree - this is very confusing. A device group is not a device as such, hence it can't have child "devices" and the method can't be used in sensible manner. However, devices as well as device groups are created through the Inventory API which does not prevent you from doing these things.

As described here, the Python API aims to be close to the REST API which no magic happening in the background. In short: as the REST API allows this, so does the Python API.

But I do get the point - I'll take this and will think of a nice way to make this clearer to the users.