ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
903 stars 91 forks source link

Create user / API Key from a Hue Bridge #591

Closed aschmidt74 closed 4 years ago

aschmidt74 commented 4 years ago

would you mind spending a few words on how to create a new user API key ona hue bridge at the moment. that seemed to be a simple issue in the past, I did it before, but the interface doesnt work like this anymore.

ebaauw commented 4 years ago

See https://developers.meethue.com/develop/get-started-2/.

aschmidt74 commented 4 years ago

thank you for the quick response! yes, the hub provides the debug/clip.html form but provides no response on a GET /api/newdeveloper

ebaauw commented 4 years ago

What are you trying to do? The API key is generated by the Hue bridge, (it looks something like: GhSaEBjwQHkBlaHjdsQxTFchZ8LqYszAhuJiYNZF), so a GET of /api/newdeveloper will fail. Note that the key is case sensitive.

aschmidt74 commented 4 years ago

trying to get a key as in step 3 the key IS CS, yes however I fail in step 1 even requesting basic information from the API via its own form!

did they change something? is some message body neccesary? a simple GET /api/newdeveloper should provide a response like error / unauthenticated user - SOME response. I get none.

aschmidt74 commented 4 years ago

ha! as a direct GET via URL http://192.168.6.20/api/newdeveloper I get this: [{"error":{"type":1,"address":"/","description":"unauthorized user"}}] as expected

aschmidt74 commented 4 years ago

why is its own "CLIP API Debugger" form not working ?!

ebaauw commented 4 years ago

Dunno. Maybe they broke it with a recent firmware? I haven't used it for ages.

Alternatively, you could try and create an API key by pressing link button on the bridge and issuing:

$ ph -H 192.168.6.20 createuser
aschmidt74 commented 4 years ago

good idea ... will try that right away in the config json the users branch has a 2nd prefix parameter "001788FFFExxxxxx". whats that supposed to be?

aschmidt74 commented 4 years ago

worked with ph. thanks for the hint! that was a tough key to get :)

aschmidt74 commented 4 years ago

bridge-ID is the first one. I get it.

plugin runs, homebridge too. nothing obviously wrong in the log homebridge-hue.json.gz looks complete too. yet - no devices in the frontend.

thats the relevant part of the config.json { "name": "Hue", "forceCt": true, "hosts": [ "192.168.6.20" ], "lights": true, "nativeHomeKitLights": true, "nativeHomeKitSensors": true, "nupnp": true, "resource": true, "platform": "Hue", "users": { "BridgeID": "API KEY" }

ebaauw commented 4 years ago

Did you pair homebridge with HomeKit? By "frontend" you mean Apple's Home app?

With your config.json, you're only exposing lights - you do see any in the Hue app?

aschmidt74 commented 4 years ago

No I don't. I traced down the issue to an outdated node version. For the moment I deleted the plug-in, for it tries to create a new user with every restart, though the former started fine with the former generation. It keeps modifying the config.json beyond control.

aschmidt74 commented 4 years ago

It's only lights I want. Let there be light! ;)

ebaauw commented 4 years ago

I traced down the issue to an outdated node version.

I develop and test against the latest LTS version of NodeJS. Other versions might work... or not. This is a hobby project; I don't want to spend my time checking other versions.

it tries to create a new user with every restart

Then you probably specified the wrong bridgeid in config.json. Note that this is also case sensitive, best copy the value from the log file.

It keeps modifying the config.json beyond control.

Homebridge-hue doesn't modify config.json.

aschmidt74 commented 4 years ago

the version requirements fail according to the log, even though the communication seems right.

I always copy the users string as it is to the config.json - restart, works. Next restart: new user request protocol with the bridge. Old user gone from the config.Jason

I'll see to it to get my node version issue resolved and look at it again.

Thank you much for your support!