Yeelight binding?

Dear OH community, today I received my Yeelights,
RGBWW LED, Less than 20 bucks and they work nicely via mobile app.

I was happy getting those, but than I tried to find bindings for them.

They are quite well documented and I thought they must be easy to integrate


With their c code sample, I can control the device via LAN without any issues.
http://www.yeelight.com/en_US/developer

only binding I could find was for the Milight but It seems to be a different protocol.

Did I missed something?
It´s my first days in OH, and I thought most devices would be easy to integrate.
Unfortunately I don’t know how to write bindings on my own yet and I don´t want to write C+ to integrate into Java.
I had to learn Java 13 Years ago. but forgot most parts of it :slight_smile:

Please help a OH rockie to get first success :wink:

Cheers
Sven

2 Likes

This should be possible in oh2. The Bluetooth example binding includes yee light although it was only a demonstration so would need to be split into a separate binding and improved.

As far as i understand, the Yeelight uses Local Wifi Ip.
I tested their code sample and it is possible to get/set values over Wifi via local ip.

This bulb is like Philips hue but costs only 23$ which is a great alternative.
Is there any chance that some more advanced OH user could create a binding in near future?

I´m based in Berlin and could share my bulb for testing.

Would love to see this too…

I guess these bulbs are more like LIFX than hue. Works independently without any hub.
Currently I use a simple bash script and Exec Binding to control them.

Ah - ok, the Yeelight that I have is a BLE version (I think it’s Yeelight-Blue) - I guess they sell different interfaces…

BLE aka blue is for bluetooth
The other version is WIFI.
You only need one time setup the bulb with the Wifi, after it has its local IP you can directly connect to bulb without any hub and sent/read status updates.

The App works quite nice.
I think for a programmer it should be quite easy to create the binding since everything is documented an open.

To get by until someone can write a binding, you can write C/C++ program(s) based on that c code example that OH calls using the Exec binding and/or executeCommandLine. Since you are already successful using their c code example you might be able to use it as is or make very slight modifications and interact with the bulbs that way.

Obviously a full up binding would be preferable but sometimes we have to make do. Exec binding is one such way you can get to your first success without waiting for a binding.

I know - that’s why I said I had it working when I wrote the Bluetooth binding :wink:

I had a look into the specs you posted and think, writing a binding should not be a big problem, as I already used SSDP messages in the WeMo 1.x binding.
Unfortunately, I can not start coding before mid of October, so there will be no quick solution.

That would be awesome! i have a few of these bulbs lying around waiting for a nice way of integrating them into Openhab.

That would be awesome
I dont´t need a quick solution.

It´s fine when I know that can integrate Yeelights in the near future into OH and don´t need to buy new bulbs.

so, while waiting, i tried playing around with TCP Binding.
the system is OH2 on a RasPi

tcp.cfg (everything else set to default)
# Post-amble that will be appended to data being sent postamble=\r\n

item:
Switch stairway "Stairway" {tcp=">[ON:192.168.31.103:55443:'MAP(yeelight.map)'], >[OFF:192.168.31.103:55443:'MAP(yeelight.map)']"}

sitemap
Switch item=stairway

yeelight.map
ON={"id":1,"method":"set_power","params":["on","smooth",500]} OFF={"id":1,"method":"set_power","params":["off","smooth",500]}

i’ve been able to turn the bulb on/off, and seems like it 's returning its status

log
10:53:49.459 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - Connecting the channel Channel [item=stairway, command=OFF, direction=OUT, remote=/192.168.31.103:55443, buffer=, isBlocking=false, isReconnecting=false, channel=, host=192.168.31.103, port=55443] 10:53:49.565 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - Updating states with returned values will be set to the default value of true 10:53:49.588 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - The characterset will be set to the default value of ASCII 10:53:49.966 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The channel for /192.168.31.103:55443 is now connected 10:54:31.225 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'stairway' received command ON 10:54:31.250 [INFO ] [marthome.event.ItemStateChangedEvent] - stairway changed from NULL to ON 10:54:31.571 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '{"id":1, "result":["ok"]} {"method":"props","params":{"power":"on"}} ' with the file 'yeelight.map' : Target value not found in map for '{"id":1, "result":["ok"]} {"method":"props","params":{"power":"on"}} ' 10:54:31.576 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input {"id":1, "result":["ok"]} {"method":"props","params":{"power":"on"}} to match command OFF on item stairway 10:54:31.583 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '{"id":1, "result":["ok"]} {"method":"props","params":{"power":"on"}} ' with the file 'yeelight.map' : Target value not found in map for '{"id":1, "result":["ok"]} {"method":"props","params":{"power":"on"}} ' 10:54:31.588 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Can not parse input {"id":1, "result":["ok"]} {"method":"props","params":{"power":"on"}} to match command ON on item stairway

i think i just need to find a way to parse the returned json value

1 Like

You might get some help with the JSON from this thread.

Any news on the integration?

Cheers

I’m also curious if there is any progress being made…

Bump for this thread? Any news on the integration?

I did not start as meanwhile, @coasterli, developer at Yeelight steped into.

@coasterli, any news here ?

Coding complete, being tested internal.

@hmerk any advise about how to publish?

See Contributing page.
Basically you need to create a pull request to this repository:

pls publish! thx :slight_smile:

1 Like