studioimaginaire / phue

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

Getting TypeError when calling anything past connect() #179

Closed VariableIQC closed 3 years ago

VariableIQC commented 3 years ago

Whenever I try to use a function such as get_light() or get_api() after "successfully" connecting to the bridge, it errors out, saying (Line 836 phue.py) TypeError: can only concatenate str (not "NoneType" to str).

I went in and did a bit of debugging and found that the state variable looks like this:

{'error': {'type': 1, 'address': '/lights', 'description': 'unauthorized user'}}

App still works, and lights are on.

natcl commented 3 years ago

Can you check your home folder for a .python_hue file ? It should have your authorization info there.

VariableIQC commented 3 years ago

Can you check your home folder for a .python_hue file ? It should have your authorization info there.

I looked in the directory where my program is and I don't see anything in there, same with the package installation directory.

I should mention the program works perfectly fine when I use it on my own network, however when I try to use it on my buddy's bridge (where this program will end up living) I get the error.

natcl commented 3 years ago

Is his bridge authorized ? He needs to press the button too.

VariableIQC commented 3 years ago

Yes, it still throws the normal error when the bridge button isn't pressed. It's only after I sync with the bridge properly that I get that authorization issue

natcl commented 3 years ago

Can you check for the .python_hue file, it should be in the home/user folder.

-- lecaude.com studioimaginaire.com

Le 29 déc. 2020 à 15:35, VariableIQC notifications@github.com a écrit :

 Yes, it still throws the normal error when the bridge button isn't pressed. It's only after I sync with the bridge properly that I get that authorization issue

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

VariableIQC commented 3 years ago

I'm using raspbian linux, where would it place the .python_hue file?

natcl commented 3 years ago

Most probably in /home/pi/.python_hue

VariableIQC commented 3 years ago

Doesn't appear to be there.

natcl commented 3 years ago

It’s a hidden file, make sure you do la -al in the terminal to see it.

-- lecaude.com studioimaginaire.com

Le 31 déc. 2020 à 13:23, VariableIQC notifications@github.com a écrit :

 Doesn't appear to be there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

VariableIQC commented 3 years ago

Alright, I do see the .python_hue file now.

natcl commented 3 years ago

Does it seem to contain your API key ?

-- lecaude.com studioimaginaire.com

Le 31 déc. 2020 à 15:13, VariableIQC notifications@github.com a écrit :

 Alright, I do see the .python_hue file now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

VariableIQC commented 3 years ago

It contains the IP of the bridge and a username, yes. Could this cause issues when swapping between bridges or does it update itself?

natcl commented 3 years ago

If you redo the pairing it should work but you could always try deleting the file and re-pairing.

VariableIQC commented 3 years ago

Alright, if all else fails I'll delete the file and re-pair. I think it was just failing to overwrite the existing file (or just wasn't expecting it had to). Preciate the help