Mik13 / nuki-bridge-api

An API for Nuki Bridge
MIT License
9 stars 8 forks source link

Support for Nuki Opener #13

Closed Zefau closed 3 years ago

Zefau commented 5 years ago

Hi there, it's me again. :-)

In the course of the implementation of the support for the Nuki Opener I was wondering if you could apply some changes to your library?

Specifically, it is (for now) only necessary to add the parameter deviceType (0 for the Nuki Smartlock, 2 for the Nuki Opener) to the both lockState and lockAction.

See also https://github.com/Zefau/ioBroker.nuki2/issues/18#issuecomment-529941543.

Thanks in advanced and Cheers, Zefau

Mik13 commented 5 years ago

Hi Zefau!

It appears that the parameter is optional, as the specs says here: https://developer.nuki.io/page/nuki-bridge-http-api-190/4

If we implement that, we should do it the right way and getting the deviceType from the list-endpoint, and send that with the the next requests. Is there a reason against that?

Zefau commented 5 years ago

Specs are unfortunately wrong, see https://developer.nuki.io/t/nuki-opener-api-error/2576/2?u=zefau.

I agree with your approach. Thanks in advanced.

Mik13 commented 5 years ago

Oh I see, very unclear in the docs yes.

Maybe we can implement something like I wrote in #12 in the Nuki._request function to check if the Nuki deviceType is set, and set it if not already, and then do the request with the correct params.

Zefau commented 5 years ago

I started implementing this and I was wondering about the third parameter of new Nuki(), which apparently only offers two parameters (I think the third one was meant for new Bridge())?

See https://github.com/Mik13/nuki-bridge-api/blob/65e802f5eee2cf9e9c9d1b391b749f4a69648876/lib/bridge.js#L86

and https://github.com/Mik13/nuki-bridge-api/blob/master/lib/bridge.js#L104 https://github.com/Mik13/nuki-bridge-api/blob/master/lib/bridge.js#L122

but

https://github.com/Mik13/nuki-bridge-api/blob/65e802f5eee2cf9e9c9d1b391b749f4a69648876/lib/nuki.js#L22

Zefau commented 5 years ago

I simply removed it now, see https://github.com/Mik13/nuki-bridge-api/pull/16.

Mik13 commented 3 years ago

I think we can close this issue.