studioimaginaire / phue

A Python library for the Philips Hue system
Other
1.52k stars 267 forks source link

Can't Connect to Bridge #121

Open austin3410 opened 6 years ago

austin3410 commented 6 years ago

Whenever I use the first 2 commands I get an error. I'm extremely new to this so I apologize for my ignorance. `

from phue import Bridge b = Bridge("10.10.10.11") Traceback (most recent call last): File "", line 1, in File "phue.py", line 629, in init self.connect() File "phue.py", line 752, in connect self.register_app() File "phue.py", line 720, in register_app 'The link button has not been pressed in the last 30 seconds.') phue.PhueRegistrationException `

Am I just being stupid and missing something? I cloned the repo to a folder, ran the setup with python and then started the python interpreter in the same directory.

Any advice would be appreciated :)

demosdemon commented 6 years ago

The very first time you interact with the hub, you need to press the button within thirty seconds before calling that code to authenticate. After that, the Bridge object saves its unique username so that it may make future calls without needing to press the button.

tremby commented 6 years ago

Where does it save to?

pacobyte commented 6 years ago

@tremby On Windows, I believe it saves to your %USERPROFILE% folder.

bmedicke commented 6 years ago

You can check where it gets saved to for your OS here:

https://github.com/studioimaginaire/phue/blob/00c85d8ce9790d7cc794d277af2d153c92c6009c/phue.py#L609-L616

tremby commented 6 years ago

That's important to know when getting a new bridge. I suggest putting it somewhere in the readme.

Bashkit commented 5 years ago

Just ran into this issue after resetting bridge to factory defaults. Once you reset your bridge you must also delete the python_hue file in your user dir, then use the connect() command again. Push the bridge button and run connect() again.

zjgcainiao commented 5 years ago

To connect a bridge, you have to use both the ip_address and the username one example is b=Bridge("192.168.0.20","sew45dsre3435esdwe") To find the username on a hue bridge on a local ethernet, open the https://discovery.meethue.com/ and write down the id.

YYY003 commented 5 years ago

To connect a bridge, you have to use both the ip_address and the username one example is b=Bridge("192.168.0.20","sew45dsre3435esdwe") To find the username on a hue bridge on a local ethernet, open the https://discovery.meethue.com/ and write down the id.

Despite trying your suggestion nothing saves me from this:

ERROR: unauthorized user for light 9

Any idea?

danielrosnl commented 3 years ago

Hi, I see this is a few years ago and I have the same problem now, I accidentally deleted Phue via my philips hue bridge but can't connect anymore, did you find an answer?

natcl commented 3 years ago

Did you press the link button ?

mindheist commented 3 years ago

Yeah .. still having the same problem.. but worked after hitting the button on the hue bridge.

LaughingMaann commented 1 year ago

i also get the same error. but this only happened after using a different host machine to connect to the same bridge/bulb.

ERROR: unauthorized user for group 1

[[{'error': {'type': 1, 'address': '/groups', 'description': 'unauthorized user'}}]]

LaughingMaann commented 1 year ago

this is fixed if you go onto here and literally follow each step https://developers.meethue.com/develop/get-started-2/ ^paste the provided username into the .python_hue in your C:\Users\LaughingMaann ^open app via phone, delete the bridge and bulb from your hue app, and re-add both the bulb and bridge back onto the app.