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

[yeelight] Add support for yeelight 650 with ambient light (Closes #6… #6749

Merged
merged 6 commits into from
Feb 29, 2020
Merged

[yeelight] Add support for yeelight 650 with ambient light (Closes #6… #6749

merged 6 commits into from
Feb 29, 2020

Conversation

vkoop
Copy link
Contributor

@vkoop vkoop commented Jan 2, 2020

Fixes #6227 - Support for Yeelight 650 (ceiling4)

  • added needed enums, constants etc.
  • added channel to control ambient light color / brightness
  • added channel to switch to nightlight mode
  • started implementing unit tests

@TravisBuddy
Copy link

Travis tests were successful

Hey @vkoop,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

1 similar comment
@TravisBuddy
Copy link

Travis tests were successful

Hey @vkoop,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@Hilbrand Hilbrand added the enhancement An enhancement or new feature for an existing add-on label Jan 6, 2020
@@ -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`.|
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

@TravisBuddy
Copy link

Travis tests were successful

Hey @vkoop,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@TravisBuddy
Copy link

Travis tests were successful

Hey @vkoop,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@martinvw martinvw added the cre Coordinated Review Effort label Jan 13, 2020
Copy link
Member

@J-N-K J-N-K left a 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) {
Copy link
Member

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.

Copy link
Contributor Author

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)) {
Copy link
Member

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.

Copy link
Contributor Author

@vkoop vkoop Jan 31, 2020

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.

@TravisBuddy
Copy link

Travis tests were successful

Hey @vkoop,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@J-N-K
Copy link
Member

J-N-K commented Feb 2, 2020

@Hilbrand I guess your request was fulfilled. Can you approve?

markus7017 added a commit to markus7017/openhab-addons that referenced this pull request Feb 8, 2020
…model,

e.g. Teufel 3sixty

Signed-off-by: Markus Michels <[email protected]>
@J-N-K J-N-K dismissed Hilbrand’s stale review February 29, 2020 15:11

seems to be fulfilled

@J-N-K J-N-K merged commit 98e3746 into openhab:2.5.x Feb 29, 2020
@cpmeister cpmeister added this to the 2.5.3 milestone Mar 19, 2020
leluna pushed a commit to leluna/openhab2-addons that referenced this pull request Mar 21, 2020
…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]>
@vkoop vkoop deleted the feature/6227-yeelight-ceiling-v4-support branch March 28, 2020 09:00
Hans-Reiner pushed a commit to Hans-Reiner/openhab2-addons that referenced this pull request Apr 11, 2020
…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]>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request May 29, 2020
openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
LoungeFlyZ pushed a commit to LoungeFlyZ/openhab2-addons that referenced this pull request Jun 8, 2020
…enhab#6… (openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
J-N-K pushed a commit to J-N-K/openhab-addons that referenced this pull request Jul 14, 2020
openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
…enhab#6… (openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
…enhab#6… (openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
…enhab#6… (openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
…enhab#6… (openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
…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]>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
openhab#6749)

* [yeelight] Add support for yeelight 650 with ambient light (Closes openhab#6227)

Signed-off-by: Viktor Koop <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cre Coordinated Review Effort enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[yeelight] Support for Yeelight LED Ceiling Lamp v4
6 participants