Yeelight led ceiling light compatible with HA


#121

Alright. I should provide some details about the implementation: Do you know the mDNS name / device_type of your yeelight? If you use auto-discovery we need to make sure your device doesn’t produce a UNKNOWN error at the moment. This error is fixed in a recent version of netdisco which isn’t part of Home Assistant yet. If you have configured your yeelight by a static entry in your configuration.yaml you must add a configuration parameter called “model”. The configuration must look like this:

  - platform: yeelight
    devices:
      192.168.130.25:
        name: yeelight bedroom
        use_music_mode: False
        model: ceiling4
      192.168.130.26:
        name: yeelight livingroom
        use_music_mode: False
        model: ceiling

I added the following specs right now:

YEELIGHT_SPECS = {
    'white': {'min_kelvin': 2700, 'max_kelvin': 2700},
    'rgb': {'min_kelvin': 1700, 'max_kelvin': 6500},
    'strip': {'min_kelvin': 1700, 'max_kelvin': 6500},
    'bslamp1': {'min_kelvin': 1700, 'max_kelvin': 6500},
    'ceiling1': {'min_kelvin': 2700, 'max_kelvin': 6500},
    'ceiling2': {'min_kelvin': 2700, 'max_kelvin': 6500},
    'ceiling3': {'min_kelvin': 2700, 'max_kelvin': 6000},
    'ceiling4': {'min_kelvin': 2700, 'max_kelvin': 6500},
}

I’m not very sure about the different specs. I would be happy if everybody could check his light.


#122

Hey @syssi that pastebin was for manual config entry using model ceiling1. Still showed unknown initially and then switched to color. Will experiment with other models as well.


#123

Did you add the “model” parameter? This is important.


#124

Yeah I did but my config was different from yours. Tried again with the config you shared - ceiling and ceiling1 models and got the same result:

light:
  - platform: yeelight
    devices:
      192.168.31.140:
        name: Kitchen Ceiling Lamp
        use_music_mode: False
        model: ceiling1
        transition: 350

https://pastebin.com/raw/6hyiG9wG

It seems to me that manual config entry is not working and the auto-discovery light is detected and has the bug you mentioned.

Update: Turned off auto-discovery and got the manual entry to work. Tried ceiling and ceiling1. Ceiling had the same result. Ceiling1 was weird because the temp slider became unresponsive completely. Could not drag it at all.

Found something! The mired range seems to be in kelvin instead.

“min_mireds”: 6500,
“max_mireds”: 2700,

https://pastebin.com/raw/KXGXSx8i


#125

I guess the mired range setting needs to convert the spec from kelvin to mired.

Tested this change successfully. It works proper now. Slider goes all the way to max and sets the temp correctly. No more errors in log.

    if self._model is not None and self._model in YEELIGHT_SPECS:
        self._min_mireds = YEELIGHT_SPECS[self._model]['max_kelvin']
        self._max_mireds = YEELIGHT_SPECS[self._model]['min_kelvin']

should be

    if self._model is not None and self._model in YEELIGHT_SPECS:
        self._min_mireds = kelvin_to_mired(YEELIGHT_SPECS[self._model]['max_kelvin'])
        self._max_mireds = kelvin_to_mired(YEELIGHT_SPECS[self._model]['min_kelvin'])

#126

Ups! :slight_smile: Great catch!


#127

I’ve fixed the issue.


#128

Super! I noticed that the list of effects don’t work with ceiling1. The yeelight app has a different list (eg. flash notify, candle flicker). Maybe effects need to be model-specific too.


#129

The ceiling lamp supports some effects? None of the available/chooseable effects does work?


#130

Yes to both.


#131

Cool. I will have a look. Could you confirm the color temperature range is working fine now? Please use the yeelight app to check the upper and lower limits. Do we use the full (supported) range of your device?


#132

Yes color temp is fixed. Checked with yeelight app (min and max of 2700 and 6500K both work same as HASS).

I took a screenshot of the effects from mi home (same as those in yeelight app). Just don’t ask me about the friendship between gentlemen bit.


#133

Just a note:

  • Sunrise
  • Sunset
  • Tea Time
  • Night Mode
  • Reading
  • Movie Night
  • Dressing
  • Flash Notify
  • Candle Flicker

#134

The different modes/scenes/effects (I don’t know how to label the feature properly) are a set of parameters (configuration). I found this github repo with some details: https://github.com/revil-O/Yeelight-Bulb-scenes

May be we should extract the current set of scenes again.


#135

Do you need the light to do that? Can I help?


#136

I’m happy if you do some testing soon.


#137

I can also do some testing, I also have the big 650 ceiling light.

Currently there seems to be no support for the RGB ambient light within HA.

Would it maybe be a good idea, to split the rgb into a own light entity within HA? Because it’s actually completely independent from the main light.

So just have a light entity for the main light and one for the ambient light. That way you can hide the RGB picker for the main light and show it in the ambient light.

@syssi What do you think?

Also is there any way to get the current mode? I try to add a touggle button to my ha dashboard that allows me to toggle between moonlight and normal mode and therefore I need to know, in which mode the lamp currently is.


#138

Yes. A the second light (ambient) should be represented as a second light entity. I’m doing the same for the ambient light of the Philips Eyecare Lamp (light.xiaomi_miio).


#139

@syssi Would be awesome, if you could implement that :smiley:

Also is there any way to get the current mode? I try to add a touggle button to my ha dashboard that allows me to toggle between moonlight and normal mode and therefore I need to know, in which mode the lamp currently is.


#140

This will need some time and an experienced tester. The underlying library (yeelight) needs to be extended. If the library works fine the Home Assistant Component can be updated.