Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color control not working properly #21

Open
henryruhs opened this issue Mar 16, 2020 · 5 comments
Open

Color control not working properly #21

henryruhs opened this issue Mar 16, 2020 · 5 comments

Comments

@henryruhs
Copy link

henryruhs commented Mar 16, 2020

Describe the bug
Working:

  1. Turning bulb on and off
  2. Using light.mode like RAINBOW_CROSSFADE is working
  3. Changing the colors via magic hue app

Not working:

  1. Changing colors using light.rgb
  2. Changing colors using light.hue
  3. 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

@namacha
Copy link
Owner

namacha commented Mar 17, 2020

Please try light = magichue.Light(addr, confirm_receive_on_send=False)

@henryruhs
Copy link
Author

henryruhs commented Mar 17, 2020

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?

@henryruhs
Copy link
Author

henryruhs commented Mar 23, 2020

@namacha Can I help you with that issue? Properly expose the bulb via my router and give you access for debugging?

@namacha
Copy link
Owner

namacha commented Mar 29, 2020

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..

@henryruhs
Copy link
Author

henryruhs commented Mar 29, 2020

Awesome - let's keep in touch for upcoming process. In the meanwhile I integrated your library with an hack for static colors.

https://github.com/redaxmedia/chroma-feedback/blob/master/chroma_feedback/consumer/magic_hue/light.py#L64-L72

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.

https://github.com/redaxmedia/chroma-feedback/blob/master/chroma_feedback/consumer/magic_hue/api.py#L30-L36

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants