Closed Hochen97 closed 1 month ago
Message that will be displayed on users' first issue
I fixed it.
line 230 in /accessories/WyzeMeshLight.js
replace this.hexValue with hexValue.
Here's the new function:
async setHue(value, callback) {
if (value != null) {
if (this.plugin.config.pluginLoggingEnabled)
this.plugin.log(
`[MeshLight] Setting hue (color) for "${this.display_name} (${this.mac}) to ${value} : (H)S Values: ${value}, ${this.cache.saturation}"`
);
try {
this.cache.hue = value;
if (this.cacheUpdated) {
let hexValue = colorsys.hsv2Hex(
this.cache.hue,
this.cache.saturation,
100
);
hexValue = hexValue.replace("#", "");
if (this.plugin.config.pluginLoggingEnabled)
this.plugin.log(hexValue);
await this.plugin.client.setMeshHue(
this.mac,
this.product_model,
hexValue
);
this.cacheUpdated = false;
} else {
this.cacheUpdated = true;
}
callback();
} catch (e) {
callback(e);
}
}
}
Hi Jacob, if you are familiar with git could you create a pr and add your change please? That is probably the fastest way to get this fixed
Yes of course!
I tried to push a feature branch but my authentication was failing, I’m assuming because I’m not authorized on this repo. I’ll see if I can’t open a PR another way. If you have instructions (this is my first time committing to a truly open source repo that I don’t own) I’d also greatly appreciate it :)
Nevermind I figured it out :)
Describe the Bug: Wyze Color bulbs won't change color when part of a scene. All other properties propagate successfully. The specific issue only occurs when altering hue and other values simultaneously. Only altering hue does not cause this issue.
Below is continued from issue #234
So I found in the debug logs an issue where when changing multiple properties of lights as part of a scene (as @escharhon above mentioned) the P1507 (WYZE_API_COLOR_PROPERTY) value returns undefined. See below
Now, interestingly, when setting ONLY the color value, as described above, for some reason the value is NOT undefined, but indeed contains a value.
I'm not sure that this issue originates specifically from how HomeKit handles scenes, but instead how this plugin is handling that input.
And after investigating further (finding the plugin log setting) I was able to rip a log of exactly that happening.
Here's the plugin log equivalent of the hue changes working:
Interestingly the hexValue is NOT logged in this scenario, which leads me to believe this is using a different function.
I'm not intimately familiar with the codebase, so I don't quite know where to go from here. I've traced the issue to—I think—the code in setHue() on line 209 in /accessories/WyzeMeshLight.js. It's obvious in the above logs that the application successfully produces a hexadecimal hue value (ff6100) for the API to consume, however it doesn't seem to make it there.
Originally posted by @Hochen97 in https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/234#issuecomment-2094055933