issackelly / python-hue

Python client for Philips Hue -- determined via API reverse engineering
Other
152 stars 25 forks source link

method toggle() #3

Closed ocelma closed 11 years ago

ocelma commented 11 years ago

Hi,

toggle method did't work fine (on my installation).

I did this change, and now works fine:

158 #if self.state["on"]: if self.state and self.state.get('state', None) and self.state["state"].get("on", None): self.off()

( self.state is a dict. There's the key 'state', and there you can find the 'on' value )

In [46]: light.state Out[46]: { u'modelid': u'...', (...) u'state': {u'alert': u'none', u'bri': 220, u'colormode': u'xy', u'ct': 500, u'effect': u'none', u'hue': 47103, u'on': False, u'reachable': True, u'sat': 254, u'xy': [0.2693, 0.2419]}, (...) }