Color control not working properly
Opened this issue · 5 comments
Describe the bug
Working:
- Turning bulb on and off
- Using
light.mode
likeRAINBOW_CROSSFADE
is working - Changing the colors via magic hue app
Not working:
- Changing colors using
light.rgb
- Changing colors using
light.hue
- Using
CustomMode
is not working
Device
https://www.amazon.com/Required-Magic-Hue-Equivalent-Compatible/dp/B07VKJ2VW5
Code
#!/usr/bin/env python3
import magichue
from magichue import CustomMode
light = magichue.Light('192.168.1.128')
light.on = True
light.is_white = False
light.mode = CustomMode(
mode = magichue.MODE_GRADUALLY,
speed = 0.5,
colors = \
[
(255, 0, 255),
(0, 0, 255)
]
)
Note: Please introduce Exceptions for color functions that are not working or connections that cannot be established... this library is impossible to debug otherwise
Please try light = magichue.Light(addr, confirm_receive_on_send=False)
Sorry but this has no effect using that code:
import magichue
light = magichue.Light('192.168.1.128', confirm_receive_on_send=False)
light.on = True
light.is_white = False
light.rgb = (0, 255, 0)
light.update_status()
print(light._get_status_data())
Returned status:
(129, 53, 35, 97, 1, 1, 0, 0, 0, 0, 7, 15, 15, 97)
It changes the saturation to 6% for some reason...? Properly the bulb's API is different?
@namacha Can I help you with that issue? Properly expose the bulb via my router and give you access for debugging?
I found your bulb has different protocol, so I decided to buy that bulb and do some hack. But I am so busy recently, so it may take a while..
Awesome - let's keep in touch for upcoming process. In the meanwhile I integrated your library with an hack for static colors.
That being said, it would be nice to have helper methods under the Light class / API because I had to wrap modes into another function for possible import errors / unit testing.
Suggested API:
light.setMode(
mode = light.MODE_GRADUALLY,
speed = 1,
colors = \
[
(255. 0, 0),
(0, 0, 0)
]
)
light.setRGB(255, 0, 0)
light.turnOn()
light.turnOff()