Skip to content

Commit

Permalink
Merge pull request openhab#1 from kaikreuzer/cleanup
Browse files Browse the repository at this point in the history
some cleanup and fixed jar library
  • Loading branch information
claell authored May 24, 2018
2 parents 2748c87 + ff89fcc commit acab836
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 58 deletions.
4 changes: 2 additions & 2 deletions addons/binding/org.openhab.binding.yeelight/.classpath
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/yeelight_lib.jar"/>
<classpathentry kind="lib" path="/Users/kai/Documents/dev/openhab/clones/claell/addons/binding/org.openhab.binding.yeelight/lib/yeelight.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.yeelight/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.yeelight</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@

<name>Yeelight Binding</name>
<description>This is the binding for Yeelight products.</description>
<author>Coaster Li</author>

</binding:binding>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

<config-description>
<parameter name="deviceId" type="text" required="true">
<context>deviceId</context>
<label>Id of the Yeelight device</label>
<description>Id of the Yeelight device to connect with.</description>
<label>Device ID</label>
<description>Id of the Yeelight device to connect with.</description>
</parameter>
</config-description>
</thing-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</tags>
</channel-type>

<!-- Color Channel-->
<!-- Color Channel -->
<channel-type id="color">
<item-type>Color</item-type>
<label>Color</label>
Expand All @@ -27,7 +27,7 @@
</tags>
</channel-type>

<!-- Color Temperature Channel-->
<!-- Color Temperature Channel -->
<channel-type id="colorTemperature">
<item-type>Dimmer</item-type>
<label>ColorTemperature</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="yeelight"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
<thing:thing-descriptions bindingId="yeelight" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<thing-type id="dolphin">
<label>Yeelight White LED Bulb</label>
Expand All @@ -14,9 +13,8 @@

<config-description>
<parameter name="deviceId" type="text" required="true">
<context>deviceId</context>
<label>Id of the Yeelight device</label>
<description>Id of the Yeelight device to connect with.</description>
<label>Device ID</label>
<description>Id of the Yeelight device to connect with.</description>
</parameter>
</config-description>
</thing-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

<config-description>
<parameter name="deviceId" type="text" required="true">
<context>deviceId</context>
<label>Id of the Yeelight device</label>
<description>Id of the Yeelight device to connect with.</description>
<label>Device ID</label>
<description>Id of the Yeelight device to connect with.</description>
</parameter>
</config-description>
</thing-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

<config-description>
<parameter name="deviceId" type="text" required="true">
<context>deviceId</context>
<label>Id of the Yeelight device</label>
<description>Id of the Yeelight device to connect with.</description>
<label>Device ID</label>
<description>Id of the Yeelight device to connect with.</description>
</parameter>
</config-description>
</thing-type>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: yeelight Binding
Bundle-Name: Yeelight Binding
Bundle-SymbolicName: org.openhab.binding.yeelight;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .,
lib/yeelight_lib.jar
lib/yeelight.jar
Import-Package:
org.eclipse.jdt.annotation;resolution:=optional,
org.eclipse.smarthome.config.core,
Expand Down
49 changes: 16 additions & 33 deletions addons/binding/org.openhab.binding.yeelight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,39 @@ This binding integrates the [Yeelight Lighting Product](https://www.yeelight.com

## Supported Things

[Yeelight LED White Bulb](https://www.yeelight.com/zh_CN/product/wifi-led-w)

[Yeelight LED Color Bulb](https://www.yeelight.com/zh_CN/product/wifi-led-c)

[Yeelight LED Color Stripe](https://www.yeelight.com/zh_CN/product/pitaya)
- [Yeelight LED White Bulb](https://www.yeelight.com/zh_CN/product/wifi-led-w) (Thing type `dolphin`)
- [Yeelight LED Color Bulb](https://www.yeelight.com/zh_CN/product/wifi-led-c)(Thing type `wonder`)
- [Yeelight LED Color Stripe](https://www.yeelight.com/zh_CN/product/pitaya) (Thing type `stripe`)
- [Yeelight LED Ceiling Light](https://www.yeelight.com/en_US/product/luna) (Thing type `ceiling`)

## Preconditions

To control Yeelight device with this binding, you need to connect the device to your
local network at first with Yeelight app, the app could be downloaded from apple store
or google play.
To control Yeelight devices with this binding, you need to connect the device to your local network at first with the Yeelight app.
This app is available in the iOS AppStore and on Google Play.

Then you need to activate LAN control mode by enable Developer Mode in device settings, after which it will become discoverable by openHAB.

## Discovery

As SSDP defined, there are actually two kinds of discover message: searching and
advertising messages. Searching is used by device that wants to find other devices or
services that it has interests while advertising is used by any device that is willing to
announce its presence on the network.

Yeelight smart LED supports both kinds of message. It will listen on a multi-cast address,
waiting for any incoming search requests. If the request is targeted for Yeelight smart LED
(ST header contains Yeelight pre-defined value), then the device will uni-cast a response to
the searcher. The response contains some basic information about the device, e.g. IP and
port of the control service, current power status, current brightness as well as all the
supported control methods. So when the searcher received the response, it can get the
basic idea of the device. With these information, it can do further contact and control. The
advertising message is sent by Yeelight smart LED after it joined the network or after a
fixed period of time (this is to refresh its state). The message is sent to a multi-cast address
with some basic information. The receiver of the message should not respond to the
advertisement.
Yeelight smart LED devices announce themselves on the network through UPnP, so that they can be discovered.

## Thing Configuration

The Yeelight thing requires the `deviceId` from the device it should be connected to.
All Yeelight things require the `deviceId` from the device as a configuration parameter:

| Parameter | Values | Default |
|---------------------|-------------------------------------------|---------|
| deviceId | ID of the Yeelight device | - |
| Parameter | Values | Mandatory |
|---------------------|-------------------------------------------|-----------|
| deviceId | ID of the Yeelight device | Yes |

## Channels

All devices support some of the following channels:

Channel | openHAB Type | Description
--------|------|------
`brightness` | `Dimmer` | This channel supports adjusting the brightness value, all kind of Yeelight devices supported.
`color` | `Color` | This channel supports color control, only color devices supported.
`colorTemperature` | `Dimmer` | This channel supports adjusting the color temperature, only part of Yeelight devices supported.
| Channel | Item Type | Description |
|--------|------|------|
|`brightness` | `Dimmer` | This channel supports adjusting the brightness value, it is available on `dolphin` and `ceiling`.|
|`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.|

## Full Example

Expand Down
5 changes: 3 additions & 2 deletions addons/binding/org.openhab.binding.yeelight/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/,\
lib/,\
about.html
lib/yeelight.jar,\
about.html,\
about_files/

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit acab836

Please sign in to comment.