Cumulocity-IoT / cumulocity-python-api

Python client for the Cumulocity REST API. Created by Global Competency Center IoT
Apache License 2.0
18 stars 13 forks source link

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

Open dsun-edwards opened 8 months ago

dsun-edwards commented 8 months ago

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.

Issue 2.

chisou commented 8 months ago

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.