lukasroegner / homebridge-nuki

Plugin for using the Nuki devices in homebridge.
MIT License
28 stars 3 forks source link

API - need some help #34

Closed iPhilBln closed 4 years ago

iPhilBln commented 4 years ago

Hey i activated the api option but get no output.

        "isApiEnabled": true,
        "apiPort": 40011,
        "apiToken": "my_own_password"

The website 192.168.***.*ip_of_my_homebridge*:40011/devices/480****/ is always blank and i have no more idea what i can change. So i need some help to configure the api to post a locked command with siri shortcuts.

lukasroegner commented 4 years ago

The API has no user interface, you can test the API with command line tools (e.g. cURL) or visual tools (e.g. Postman).

iPhilBln commented 4 years ago

I don't meant a user interface but i think into the firefox browser you can see the the output of the json file. But it makes no differences if i type into my shell on a ubuntu mashine the command with curl i get also no response.

iPhilBln commented 4 years ago

curl http://192.168.***.***:40011/devices/4801***/ -o test.txt % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

But the test.txt is empty.

lukasroegner commented 4 years ago

You forgot to set the Authorization header.

iPhilBln commented 4 years ago

Can you write me an example? I don't know where I have to add the api key. curl --user needs a username that i don't know.

lukasroegner commented 4 years ago

I would recommend to use the SSH action, which works great for me in Siri Shortcuts and Home automations. I use the following command to lock my door:

curl -X POST 'http://localhost:40011/devices/XXXXXXXX' -H 'Content-Type: application/json' -H 'Authorization: my_own_password' --data-raw '{"state":"locked"}'
iPhilBln commented 4 years ago

Thanks for your help. This command works for me.