dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 498 forks source link

deCONZ REST API allows clashing device names #6546

Closed endreszabo closed 1 year ago

endreszabo commented 1 year ago

Describe the bug

The REST API allows changing the device names using the PUT method on the name attribute. This works fine. However, it does not check if there is another device with the same name. The Phoscon app checks it (using client-side JS) and does not let me submit the form as long as the name-to-be clashes with another device.

Steps to reproduce the behavior

Rename a device to another existing device using REST. deCONZ renames the device, which will then be indistinguishable from the former one. Not sure about any other problems this might cause.

Expected behavior

REST API call should return an error, stating that another device exists with the same name.

Screenshots

Environment

deCONZ Logs

not applicable to the problem

Additional context

Smanar commented 1 year ago

IDK, I don't see the problem, if you want to call all your device "stuff", it's your choice. Device are handled with the ID (wich is unique), never with the name.

Mimiix commented 1 year ago

A name isn't a unique identifier. The rest api and database is matching on unique Id rather than name.

endreszabo commented 1 year ago

Fair enough, I don't depend on them being unique, either. Thanks for confirming it. :+1: