Callback removal changes ID

Hi there,

listing my callbacks using http://192.168.0.40:8080/callback/list?token=xxx results in (data exemplary)

{
   "callbacks":[
      {
         "id":0,
         "url":"http:\/\/192.168.178.1:9875\/nuki-api-bridge"
      },
      {
         "id":1,
         "url":"http:\/\/abc:1\/nuki-api-bridge"
      },
      {
         "id":2,
         "url":"http:\/\/xyz:9\/nuki-api-bridge"
      }
   ]
}

deleting the callback with the ID 1 results in remapping of ID 2 (xyz:9) to ID 1, as

{
   "callbacks":[
  {
     "id":0,
     "url":"http:\/\/192.168.178.1:9875\/nuki-api-bridge"
  },
  {
     "id":1,
     "url":"http:\/\/xyz:9\/nuki-api-bridge"
  }
   ]
}

Thus, it basically changes to its index. This leads to unexpected behaviours though.

I just tested this here with FW 1.12.6 and 2.2.9 and couldn’t reproduce the problem with using /callback/remove on ID=0 or ID=1 if 3 callbacks were set.

Could you check your FW versions and give me a step-by-step description of your API-calls?

My software bridge is on 1.4.6. My Nuki is on 2.5 beta.

Regarding the API calls, I was manually adding 3 callbacks by opening the URL in the browser. Then listing them and finally removing ID 1 (calling the URL in the browser).

I thought that the lock anyway issues callbacks to any URL registered, regardless which ID they have

@Zefau: does it really matter under which ID a callback is set?

I developed an adapter for an IoT plattform which reads the callbacks and offers the possibility to delete it.

If a user deletes the callback with a certain ID, it might remove the wrong callback, if the callbacks themselves have been in the mean time by any other source.

Eventually, this leads to wrong behavior because the ID itself is not unique.

Ah, sorry. I just checked hardware bridges.
Yes, I could reproduce this with software bridge 1.4.6.

Thanks a lot for the feedback!

In this course I was actually wondering if adding the same callback url multiple times works on purpose on hardware bridges? See https://github.com/Zefau/ioBroker.nuki2/issues/9 for details.

My implementation had no verification if the URL was added before already because I thought the Nuki bridge does that. Thus, the same callback URL got added multiple times. On the software bridge this does not happen.

Additionally, the Bridge API documentation (https://developer.nuki.io/page/nuki-bridge-http-api-190/4/#heading--bridge-discovery) states for the action /unpair, that it is not available on software bridges. For me the actions /auth and /configAuth are also not available. Is this a bug on the software bridge or a lack in the documentation?

Finally, the software bridge does not broadcast ip or port (but its ID) to https://api.nuki.io/discover/bridges. A note regarding this in the docs would also be helpful.

Thanks and kind regards,
Zefau

Thanks for the feedback. I will check and update the documentation in detail.