-
-
Notifications
You must be signed in to change notification settings - Fork 9
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 Set #5
Comments
Check Line 147 in 595c371
You should be able to use |
Hi Aymkdn, Thanks for reply, have a good weekend! I'm experimenting with HSV values but none change the bulb. I think it's the format I'm sending the request in, but there is no error trapping, so I'm shooting in the dark. Have sent many different format values before bothering you, and am now stuck! Tuesday is no prob if you have a chance to experiment then, Thanks, Bon |
I don't have a lightbulb, but based on https://github.com/PaulAnnekov/tuyaha/blob/5c47ce40062ab388af994299d6cf63c4add4f899/tuyaha/devices/light.py#L145-L154: hsv_color = {
"hue": color[0] if color[1] != 0 else 0, # color white
"saturation": color[1] / 100,
}
if len(color) < 3:
hsv_color["brightness"] = cur_brightness
else:
hsv_color["brightness"] = color[2]
# color white
white_mode = hsv_color["saturation"] == 0 And based on https://github.com/PaulAnnekov/tuyaha/blob/cd9baa85052028fdcf6f1ed222fb6f188016cd06/tuyaha/devices/light.py#L156: if self._control_device("colorSet", {"color": hsv_color}): It seems the {
"color": {
"hue":40,
"saturation":255,
"brightness":255
}
} Then the command might be: $tuya->setState([
"name" => "lightbulb 1",
"command" => "colorSet",
"value" => [
"color" => [
"hue" => 40,
"saturation" => 255,
"brightness" => 255
]
]
]); But I think it won't work (based on this example). If it doesn't work, then try to replace Line 184 in 595c371
with: "color" => $value And then call it with: $tuya->setState([
"name" => "lightbulb 1",
"command" => "colorSet",
"value" => [
"hue" => 40,
"saturation" => 255,
"brightness" => 255
]
]); Please, let me know the result of your tests and I'll update the file based on your feedback. |
This issue has been automatically closed because the requestor didn't provide any additional comment. |
Just looked at this, but adding |
OK Great! I'll modify my code by the end of the week! |
I've just published a new version: can you try it, please? It will check if the command is So if you try the below with the new version, it should work: $tuya->setState([
"name" => "lightbulb 1",
"command" => "colorSet",
"value" => [
"hue" => 40,
"saturation" => 255,
"brightness" => 255
]
]); As well as: $tuya->setState([
"name" => "lightbulb 1",
"command" => "turnOnOff",
"value" => 0
]); |
This issue has been automatically closed because the requestor didn't provide any additional comment. |
Hello,
|
Did you try to define all hue, saturation and brightness? $tuya->setState([
"name" => "PV Dimmer",
"command" => "colorSet",
"value" => [
"hue" => 40,
"saturation" => 255,
"brightness" => 255
]
]); |
Yes, but also no function. A dimmer has no hue and saturation. |
I moved your issue to there: #13 |
What does it mean? |
Hi Aymkdn,
Nice code in tuyacloud-php, and can set brightness, power for a bulb. How can I set a color though please? It is not documented?
Thanks,
Bon
The text was updated successfully, but these errors were encountered: