peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.18k stars 145 forks source link

Issue with user deletion? #178

Closed itsjesski closed 4 years ago

itsjesski commented 4 years ago

I'm trying to get this all setup and getting the bridge discovery working was easy enough, but I'm running into issues deleting the users that I've created. I've tried copying what is shown in the examples provided, but I always get the same error:

"ApiError: No value provided and 'username' is not optional"

I'm 100% sure that I'm passing the username to the function. For the username I've tried the long user id show in the examples, as well as the application name combo, and the entire user object. I followed the code back and logged it in Users.js on line 85 or so before this.execute gets called to make absolutely sure i'm passing something.

Is anyone else running into this issue or does anyone know how to fix it?

(node:15200) UnhandledPromiseRejectionWarning: Error: No value provided and 'username' is not optional at extractError (C:\GitHub\Firebot\node_modules\node-hue-api\lib\api\http\Transport.js:109:11) at C:\GitHub\Firebot\node_modules\node-hue-api\lib\api\http\Transport.js:69:15 at runNextTicks (internal/process/task_queues.js:58:5) at listOnTimeout (internal/timers.js:501:9) at processTimers (internal/timers.js:475:7) at async Promise.all (index 0) at async Object.exports.deleteHueUser (C:\GitHub\Firebot\backend\integrations\builtin\philips-hue\hue-handler.js:45:29) at async HueIntegration.unlink (C:\GitHub\Firebot\backend\integrations\builtin\philips-hue\hue.js:66:9)

itsjesski commented 4 years ago

After some more research, it looks like maybe hue removed this ability from their API to keep things more secure. It seems like they require people to go to https://account.meethue.com/apps to delete users.

peter-murray commented 4 years ago

It is no longer possible to remove users from the local network.

This library does work in both local and remote API forms, where you can delete a user on the remote API side (or at least that was the case when I built out support for the remote API).

The API still has this functionality as it can be used against multiple versions of the Bridge and firmware versions, as well as the local/remote options. There is a note to this in the documentation https://github.com/peter-murray/node-hue-api/blob/master/docs/users.md#deleteuser