studioimaginaire / phue

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

TypeError: list indices must be integers, not str #162

Closed jpringle1 closed 4 years ago

jpringle1 commented 4 years ago

Following the guide in the README, when i type this:

from phue import Bridge b = Bridge('192.168.0.3') b.connect() b.get_light(1, 'on')

I get this error: Traceback (most recent call last): File "<stdin>", line 1, in <module> return state['state'][parameter] TypeError: list indices must be integers, not str

What am i doing wrong? Might i have installed python or phue incorrectly? (I'm running linux).

natcl commented 4 years ago

Can you try b.get_light(1) and see what the output is ?

-- lecaude.com studioimaginaire.com

Le 25 déc. 2019 à 06:11, jpringle1 notifications@github.com a écrit :

b.get_light(1, 'on')

jpringle1 commented 4 years ago

Can you try b.get_light(1) and see what the output is ? -- lecaude.com studioimaginaire.com Le 25 déc. 2019 à 06:11, jpringle1 @.***> a écrit : b.get_light(1, 'on')

I get a different error message, but i'm still just as lost. [{'error': {'type': 3, 'address': '/lights/1', 'description': 'resource, /lights/1, not available'}}]

natcl commented 4 years ago

Seems like there is no light associated with id 1. Try b.get_api() to see a list of lights with their ids.

-- lecaude.com studioimaginaire.com

Le 27 déc. 2019 à 11:43, jpringle1 notifications@github.com a écrit :

 Can you try b.get_light(1) and see what the output is ? … -- lecaude.com studioimaginaire.com Le 25 déc. 2019 à 06:11, jpringle1 @.***> a écrit : b.get_light(1, 'on')

I get a different error message, but i'm still just as lost. [{'error': {'type': 3, 'address': '/lights/1', 'description': 'resource, /lights/1, not available'}}]

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

jpringle1 commented 4 years ago

Seems like there is no light associated with id 1. Try b.get_api() to see a list of lights with their ids.

This worked, thank you! For some reason my lights only start at 4.