Yeelight binding?

hue
Tags: #<Tag:0x00007f0141bad2b0>

(Marek) #184

current binding is not providing the brightness channel for color bulb and the brightness of the color channel doesn’t work because the yeelight uses HSV color representation and the binding is using HSB color representation. Those color representations are just not compatible.
To add missing brightness channel is very easy, just add this line:

<channel id="brightness" typeId="brightness" />

to line 12 of the addons/binding/org.openhab.binding.yeelight/ESH-INF/thing/wonder.xml file in openhab2-addons repository and build the binding. Then the brightness channel will appear and it will work correctly.

To fix the color channel some work must be done in the code.


(Marek) #185

or you can download jar with modifications from here: https://drive.google.com/open?id=13Np8lv8qiGTDV3rUBObBHoryhCyGoJRM


(Peppe) #186

great! I’m going to try right now and let you know!


(Peppe) #187

Hi Marek,
The version you posted works just fine!!!
Thank you.
The only issue I see is related to a set of warnings I get, anyhow they are not preventing the light to work:

2018-10-18 20:22:50.141 [ome.event.ItemCommandEvent] - Item 'Luce_Sala_Divano_RGB_dimmer' received command 100

==&gt; /var/log/openhab2/openhab.log &lt;==

2018-10-18 20:22:50.155 [INFO ] [nding.yeelight.lib.device.DeviceBase] - ######### this is control command response, don't need to notify status change!

==&gt; /var/log/openhab2/events.log &lt;==

2018-10-18 20:22:50.155 [vent.ItemStateChangedEvent] - Luce_Sala_Divano_RGB_dimmer changed from 31 to 100

==&gt; /var/log/openhab2/openhab.log &lt;==

2018-10-18 20:22:50.159 [INFO ] [nding.yeelight.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=false, r=255, g=94, b=214, color=16735958, brightness=100, ct=6404, hue=359, sat=100, isFlowing=false, delayOff=-1, mFlowItems=null, mode=MODE_COLOR, isMusicOn=false, name=]

2018-10-18 20:22:50.163 [INFO ] [nding.yeelight.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=false, r=255, g=94, b=214, color=16735958, brightness=100, ct=6404, hue=359, sat=100, isFlowing=false, delayOff=-1, mFlowItems=null, mode=MODE_COLOR, isMusicOn=false, name=]

2018-10-18 20:22:50.163 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler YeelightColorHandler of thing yeelight:wonder:0x00000000035b7c5c tried updating channel brightness although the handler was already disposed.

2018-10-18 20:22:50.167 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler YeelightColorHandler of thing yeelight:wonder:0x00000000035b7c5c tried updating channel color although the handler was already disposed.

2018-10-18 20:22:50.170 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler YeelightColorHandler of thing yeelight:wonder:0x00000000035b7c5c tried updating channel colorTemperature although the handler was already disposed.

(Marek) #188

I had the same warning when replacing the yeelight binding with new version. I don’t remember how i fixed it. Try to restart oh or remove all things and items related to yeelight binding and add them again


(CM6.5 H102) #189

The jar file posted above by @salexes https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.yeelight/2.4.0-SNAPSHOT/ is updated and now the latest snapshot, as of Oct 18 at 16:37


(Andrew Crisp) #190

Hi, could you advise on how you were able to get the brightness control working at all?

What do your items and sitemap file look like for the yeelights?

I’ve spent hours trying to get this working and its driving me insane, without brightness control it kinda defeats the purpose…


(Marek) #191

this is what I have:
yeelight.things

Thing yeelight:wonder:bedroom2_lamp [ deviceId="XXX" ]

yeelight.items

Dimmer bedroom2_lamp_dimmer "Small bedroom lamp [%d %%]" <light>{channel="yeelight:wonder:bedroom2_lamp:brightness"}
Dimmer bedroom2_lamp_colorTemperature "Small bedroom lamp [%d %%]" <heating>{channel="yeelight:wonder:bedroom2_lamp:colorTemperature"}
Color bedroom2_lamp_color "Small bedroom lamp [%d %%]" <colorlight>{channel="yeelight:wonder:bedroom2_lamp:color"}

(Andrew Crisp) #192

Thanks for the reply.

Interestingly, if I use paperui to add the yeelight thing, and copy your items but changing “bedroom2_lamp” to my channel id, then brightness works but not the other two. When trying to change colour I get this error: `

Received HTTP POST request at 'items/YeelightColour' with an invalid status value '114,80,100'.

If I manually add the thing and copy your items then brightness does nothing but the other two work.

Found the solution: changing the brightness channel to color and making it a Dimmer item

Dimmer YeelightBrightness "brightness [%d %%]" {channel="yeelight:wonder:0x000000000531be5f:color"}

Update: aaaaaand stuck in offline


(frest) #193

Any chance to get the second version of the color bulbs working? It is working with the mi io binding , but xiaomi supports the 2nd version on the chinese server and the chinese server does not support google home at all… :confused:

edit: it is working, missed to activate the LAN control. :smiley:


(Selter) #194

Have you successful set up the Yeelight binding with the Yeelight Color Bulbs?
I’ve the silver grey ones (1st version)?

I ran into problem with the Mi IO binding …
https://community.openhab.org/t/xiaomi-mi-io-binding-and-yeelight-color-bulb/55242

Maybe you can point me in the right direction :wink:


(Adtwomey) #195

My is working are you using Openhab 2.4 and have the yeelight App “WITH THE LAN CONTROLON” what is in the yeelight App.


(Selter) #196

I’m on oH 2.3 stable.

According to this thread
I guess I need to wait until 2.4 stable comes out or have to try the 2.4 snapshot, right?


(Adtwomey) #197

Yes


(Noam ) #198

i installed the openhab 2.4 with yeelight, it discover all my 7 rgbw bulbs, but only one online, after few minutes another one go online, but now all offline, from the yeelight app everything is working great


(Adtwomey) #199

Have you enable LAN in the application of yeelight.


(Noam ) #200

yes, if you dont enable you cant discover them


(Adtwomey) #201

Ok lot of ppl forget to do it.


(Gudszent Otto) #202

Hi All,

I little bit stuck. I bought a yeelight cell, successfully connect to wifi and I can control it with the app, but when I try to add to openhab, nothing happens.
Server: Mainland China or German( I tried both)
Lan control: Enabled
Same network
OH version: 2.4.0~M5-1
Yeelight fw: 1.5.9_0184

And nothing…

I try a yeelight_toolbox_3.0.1 app. It show and I can control it :confused:

Anybody can help me?

O.


(tom34) #203

I’m having a hard time getting this work.

odroid xu4 - 18.04.1 LTS (Bionic Beaver) build 4.14.78-150+
# dpkg -l | grep openhab
ii openhab2 2.4.0~M5-1 all openhab2
ii openhab2-addons 2.4.0~M5-1 all openhab2-addons

all yeelights are LAN enabled and work w/ e.g. home assistant w/o problems

I can’t even get openhab to detect a single light, got 1 ceiling, 2 white and 1 color bulbs.

'HTTP/1.1 200 OK\r\nCache-Control: max-age=3600\r\nDate: \r\nExt: \r\nLocation: yeelight://192.168.1.41:55443\r\nServer: POSIX UPnP/1.0 YGLC/1\r\nid: 0x0000000005e20700\r\nmodel: ceiling1\r\nfw_ver: 184\r\nsupport: get_prop set_default set_power toggle set_bright set_scene cron_add cron_get cron_del start_cf stop_cf set_ct_abx set_name set_adjust adjust_bright adjust_ct\r\npower: on\r\nbright: 3\r\ncolor_mode: 2\r\nct: 5953\r\nrgb: 0\r\nhue: 0\r\nsat: 0\r\nname: ceiling1\r\n')
'HTTP/1.1 200 OK\r\nCache-Control: max-age=3600\r\nDate: \r\nExt: \r\nLocation: yeelight://192.168.1.43:55443\r\nServer: POSIX UPnP/1.0 YGLC/1\r\nid: 0x000000000536f100\r\nmodel: ct_bulb\r\nfw_ver: 17\r\nsupport: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_adjust adjust_bright adjust_ct set_music set_name\r\npower: off\r\nbright: 56\r\ncolor_mode: 2\r\nct: 5102\r\nrgb: 0\r\nhue: 0\r\nsat: 0\r\nname: ct_bulb 2\r\n')
'HTTP/1.1 200 OK\r\nCache-Control: max-age=3600\r\nDate: \r\nExt: \r\nLocation: yeelight://192.168.1.44:55443\r\nServer: POSIX UPnP/1.0 YGLC/1\r\nid: 0x0000000005317e00\r\nmodel: ct_bulb\r\nfw_ver: 17\r\nsupport: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_adjust adjust_bright adjust_ct set_music set_name\r\npower: off\r\nbright: 100\r\ncolor_mode: 2\r\nct: 2700\r\nrgb: 0\r\nhue: 0\r\nsat: 0\r\nname: ct_bulb 1\r\n')
'HTTP/1.1 200 OK\r\nCache-Control: max-age=3600\r\nDate: \r\nExt: \r\nLocation: yeelight://192.168.1.45:55443\r\nServer: POSIX UPnP/1.0 YGLC/1\r\nid: 0x0000000007c0df00\r\nmodel: color\r\nfw_ver: 30\r\nsupport: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb set_hsv set_adjust adjust_bright adjust_ct adjust_color set_music set_name\r\npower: off\r\nbright: 56\r\ncolor_mode: 1\r\nct: 6382\r\nrgb: 16770886\r\nhue: 359\r\nsat: 100\r\nname: color 1\r\n')

running openhab w/ debug:

openhab> java.lang.IllegalArgumentException: No enum constant com.yeelight.sdk.enums.DeviceType.ct_bulb at java.lang.Enum.valueOf(Enum.java:238) at com.yeelight.sdk.enums.DeviceType.valueOf(DeviceType.java:1) at com.yeelight.sdk.device.DeviceFactory.build(DeviceFactory.java:29) at com.yeelight.sdk.services.DeviceManager$2.run(DeviceManager.java:130) at java.lang.Thread.run(Thread.java:748)

for what it’s worth, adding them manually doesn’t work either. always “offline”

hope that’s enough info :slight_smile: