-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[yeelight] Add support for yeelight 650 with ambient light (Closes #6… #6749
[yeelight] Add support for yeelight 650 with ambient light (Closes #6… #6749
Conversation
) Signed-off-by: Viktor Koop <[email protected]>
Travis tests were successfulHey @vkoop, |
1 similar comment
Travis tests were successfulHey @vkoop, |
Signed-off-by: Viktor Koop <[email protected]>
Signed-off-by: Viktor Koop <[email protected]>
… create a cached thread pool once. Signed-off-by: Viktor Koop <[email protected]>
@@ -39,6 +39,10 @@ All devices support some of the following channels: | |||
|`color` | `Color` | This channel supports color control, it is available on `wonder` and `stripe`.| | |||
|`colorTemperature` | `Dimmer` | This channel supports adjusting the color temperature, it is available on `wonder` and `stripe` and `ceiling`.| | |||
|`command` | `String` | This channel sends a command directly to the device, it is available on all Yeelight Things.| | |||
|`backgroundColor` | `Color` | This channel supports color control for the ambient light, it is available on `ceiling4`.| | |||
|`backgroundBrightness` | `Dimmer` | This channel supports adjusting the ambient light brightness value, it is available on `ceiling4`.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backgroundBrightness
should probably not be a separate channel. The convention is that a user can create a Dimmer item on the color channel and that should be handled as setting the brightness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware of this convention. I will adapt the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can imagine, there is a lot to know. For this see https://www.openhab.org/docs/concepts/items.html#a-note-on-items-which-accept-multiple-state-data-types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hilbrand I've implemented the changes as suggested and combined ambient light color and brightness into one channel.
Travis tests were successfulHey @vkoop, |
Signed-off-by: Viktor Koop <[email protected]>
Travis tests were successfulHey @vkoop, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left two comments. Thanks for adding tests.
mDeviceStatus.setActiveMode(ActiveMode.values()[activeMode]); | ||
} | ||
} | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary to catch Exception
here? Whatr type of exceptions do you expect? The problem with catching Exception
is that it also catches NPE and therefore might hide programming errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the try/catch block is needed at all and will remove it.
updateProp += " power"; | ||
for (Entry<String, JsonElement> prop : propsObject.entrySet()) { | ||
final YeelightDeviceProperty property = YeelightDeviceProperty.fromString(prop.getKey()); | ||
if (YeelightDeviceProperty.POWER.equals(property)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be possible to use switch (property)
here? Since Java 7 we can switch on strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I didn't want to refactor to much of the code to simplify the review process.
I've changed the if/else block to a switch statement.
Signed-off-by: Viktor Koop <[email protected]>
Travis tests were successfulHey @vkoop, |
@Hilbrand I guess your request was fulfilled. Can you approve? |
…model, e.g. Teufel 3sixty Signed-off-by: Markus Michels <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]> Signed-off-by: leluna <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]> Signed-off-by: Hans-Reiner Hoffmann <[email protected]>
openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
…enhab#6… (openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]> Signed-off-by: Daan Meijer <[email protected]>
openhab#6749) * [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227) Signed-off-by: Viktor Koop <[email protected]>
Fixes #6227 - Support for Yeelight 650 (ceiling4)