smarthall / python-lifx-sdk

An SDK for local LAN control of bulbs, using Python
MIT License
27 stars 9 forks source link

Setting the light color etc sometimes stays other times reverts #2

Closed ceboxsell closed 9 years ago

ceboxsell commented 9 years ago

Hi Daniel, if this isn't the right place for this let me know.

Using your SDK I can connect to the lights and turn on and off easily but have found if I set the saturation etc in the same way sometimes it works other times it doesn't I have also noted at times a light changes to the new hue but then as the script is working on other lights the previous light changes back to the old colour, this happens when it feels like it.

I suspect it is just me but it is rather odd.

This is from your examples. for i in lights.get_devices(): print '--- Device: "%s" ---' % i.label print 'Power: %r' % i.power color = i.color print 'Color:' print ' Hue: %d' % color.hue print ' Saturation: %d' % color.saturation print ' Brightness: %d' % color.brightness print ' Kelvin: %d' % color.kelvin I added print ' powerup the light' i.power = True print 'set the colour' print ' the current colour is %d' % color.hue i.saturation = 1 i.hue = 80 i.brightness = 1

I am just a hack so forgive me for my lack of knowledge.

frakman1 commented 7 years ago

I ran into the same problem. Apparently, the setters don't work consistently. For example setting brightness results in a change in actual bulb brightness (works) but setting the hue doesn't result in a change of colour (does not work). I had to completely define the colour before it would work as expected. Try this:

new_color = HSBK(180,1,1,3500)   # Hue, Saturation, Brightness, Kelvin
light.fade_color(new_color, 1000)   # The 1000 is duration in ms