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

[Request] Hue and Saturation for Yeelight Color bulb #30

Closed
jghaanstra opened this issue May 21, 2017 · 7 comments
Closed

[Request] Hue and Saturation for Yeelight Color bulb #30

jghaanstra opened this issue May 21, 2017 · 7 comments

Comments

@jghaanstra
Copy link

According to someone from the Xiaomi Yeelight staff there is an interface to change hue and saturation for the Yeelight Color bulbs. Would be nice if this could be added to the YeelightColor class next to the setRGB (which seems to be undocumented in the device documentation).

My Yeelight Color bulb is still on transport from China so cant check if this interface is exposed though.

@aholstenson
Copy link
Owner

Yeah, I think there is a call for setting those values. I saw a reference to it when I implemented the first version of the API for the Yeelights.

I have color bulb on the way as well so haven't been able to implement and test it yet. Looks like it might arrive this week though so shouldn't take long after that to add support for this.

@jghaanstra
Copy link
Author

Nice, if there is anything I can do to help (once my bulb arrives) let me know.

@jghaanstra
Copy link
Author

Well, I just found out that there are no seperate calls for hue and saturation but there is a set_hsv that allows to set hue and saturation in a single call, but only if color_mode is set to 3.

You probably are already aware of this but everything is pretty well described here: https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf

I'm not much of a programmer so I'm hoping you can work with this and implement it in a future release.

@jghaanstra
Copy link
Author

Not sure if this is a bug or if I'm doing something wrong. I was trying to test the set_hsv methode through the CLI but I cant get any params to work. I tried a couple of different syntaxes for the params but they all end up with mostly the same error.

I have tried:

  • miio --control 192.168.0.129 --method set_hsv --params '[255,45,"smooth",500]' (as documented)
  • miio --control 192.168.0.129 --method set_hsv --params '["255","45","smooth","500"]'
  • miio --control 192.168.0.129 --method set_hsv --params [{255,45,"smooth",500}]

All end up with something like:
(node:13768) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token ' in JSON at position 0

or

(node:20424) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected number in JSON at position 2

Could you point me into the right direction?

@aholstenson
Copy link
Owner

It might be that the Yeelight does something special with its responses. I haven't had the chance to unpack and have a look at mine yet. Hopefully soon.

You can try running miio with debug on and see if that makes more sense:

DEBUG=miio* miio --control 192.168.0.129 --method set_hsv --params '[255,45,"smooth",500]'

@aervin
Copy link

aervin commented Oct 1, 2017

I think it mentions somewhere in the manual that these bulbs silently drop requests if they don't have an "id" prop. And requests must end with: \r\n\.

@jghaanstra
Copy link
Author

I'm closing this issue, you can control the Yeelights directly through their open API. No need for this library.

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

No branches or pull requests

3 participants