Yeelight led ceiling light compatible with HA

@madrian For now, I’ve added binary sensor that shows current daylight / nighlight mode, it should be created for each ceiling light. Its possible to make some template switch now ( with correct state, without input_boolean ).
Except of that I’m working on adding separate light entity for moonlight. If you want to test, give some feedback, current code is here: https://github.com/home-assistant/home-assistant/tree/a33ad8116f1bc14eb9eae69ad207c5d952e2b590/homeassistant/components/yeelight . You can use it as custom component. It creates moonlight light, which interlocks with daylight light entity.

1 Like

I tried it, it works nicely.

It is a little bit weird that:

normal mode -> moonlight -> back to normal and light is off

I think If I switch back to normal mode it should switch back to previous state, not simply OFF.

In my opinion the behaviour is fine. If you go to bed and turn off the moonlight what do you expect?

Hmm when moonlight is on, you can turn it off ( and whole lamp / device ) or turn on main light entity ( to turn light into daylight ). Probably it would be possible to add some config option to control what should happen when turn off moonlight entity.

1 Like

Hi There!
Firtst of all great thanks for your work.

Should I setup the yeelight component manually to get this moonlight/normal state sensors?
I am asking because currently I use autodiscovery for lights and there are no any new sensors for my ceiling lights.

The ceiling light uses the last state , if it was the moonlight from the night automation then it continued to use it after the period of automation is ended. Therefore I setup in the HAdashboard the on stage with attributes in the interest of switching on the lights with day state. For example:

nappali:
    widget_type: light
    title: nappali
    entity: light.yeelight_ceiling4_7c49ebb70c75
    icon_on: fa-lightbulb
    icon_off: fa-lightbulb
    on_attributes:
        brightness: 100
        color_temp: 250

It has worked well so far but doesn’t work after the update. If I switch on the light with the widgets then remains the moonlight state with a weird lighting. I have to change the state with the remote control again.

The other things:
I have 3 ceiling lights (2 pieces of YLXD01YL and 1 of YLXD02YL) and 4 bulbs but I got a binary sensor for only one ceiling light (YLXD02YL), is it ok?

Which model of the ceiling light do you have?

Nightlight sensor should be added for ceiling3 and ceiling4. In the new code ( with separate moonlight light entity ), there is better method to detect whether moonlight is supported by the device or not.

If the device was added manually via configuration you should add the model attribute per entity to your configuration. There are some models without nightlight support. The fallback model has no nightlight support, therefore no sensor is created. It’s just a guess. Please provide some details about your setup possibly.

Could you provide additional details?

I think that behavior changed in the underlying lib, python-yeelight. Now turning on light will use last state, so only way to change mode is via yeelight.set_mode service call. Or after some refactor, changing new moonlight light entity in HA.

As for missing sensor. Can you provide mdns name / or configured model ? Like for example “light.yeelight_ceiling4_7c49ebb70c75” its ceiling4, which is listed in library to have nightlight support. I assume YLXD01YL is ceiling1 ? If yes, it has moonlight support ?

1 Like

Is it possible to make config option to separate light or not?

You mean option to add daylight / moonlight entity or keep current behavior ? ( Only one light ? ). Its possible, but its not well supported by voice assistants. As single entity change its supported_properties. Moonlight doesn’t support light temperature change. It also requires some code complications. Can you describe more of your use case, why you want to have this option ? I can guess that you want to have single entity with state on, when moonlight is also on ? ( Like its now ? ).

Yes. You right. I dont want to have 2 lights. Sorry for my bad english

I totally agree. I tested the new component yesterday and it worked great and intuitive with one light entity (despite I also haven’t found the moonlight sensor with ceiling4 yet). So what would be the benefit to split the lamp into two lamps?

Edit: I just found the moonlight sensor: (binary_sensor.NAME_nightlight).

  1. Avoids a big jump of the brightness between moonlight mode and normal model
  2. Avoids leaving the moonlight mode by mistake while changing the brightness
  3. Avoids the need for different specifications of one light entity depending on the current mode
  1. There is no big jump except the one that is per default. When I turn on the moonlight mode, the brightness is maximized and when I switch to daylight, the brightness is minimized (as this is set as default for my lamp). So the jump is already minimized in my setup.
  2. This is true, I am not a fan from the automatic transition between the modes with the brightness slider. However, this is also not the case at the moment because you have to use a template switch for mode change.
  3. This is a good point, although it doesn’t seem to be a problem at the moment. However, I am not sure if synchronizing the state of two light entries with on/off states and the whole logic behind this is very intuitive

I can confirm this, I have two ceiling3 and one ceiling1 (YLXD01YL), all of them support moonlight, but only ceiling3 shows up as binary_sensor.

And I will stick with set_mode for now since I have lot automations based on daylight and set_mode/brightness. also my Yeelight Wall Switches are configured to switch moonlight (doublepress) and sunlight (singlepress) via set_mode to make it easier for family members to use it.

In future I will try to replace the switch with Yeelight Dimmer (on the way), and I hope it gets integrated well enough to make it even more easier to use for everyone in the house.

My main idea is to provide some option to change daylight / moonlight mode via UI. And to improve switching moonlight off, now when you turn off light, it stays in moonlight, and only way to change it is to use service call set_mode , or via yeelight app or remote. You can’t easy turn on light in day light, in that case.

@thawizard Ceiling1 isn’t declared as having moonlight, thats why it doesnt work. I will push PR with change upstream, and new code gets better ability to check moonlight support per device. Set_mode will stay for sure.

i know its not declared yet, i just wanted to confirm that ceilight1 has moonlight mode :slight_smile:

the only thing yeelight component needs is a new button near to an entity’s brightness slider to toggle moonlight/sunlight. something like this maybe:
screenshot_1110
that would be perfect.

1 Like