Setting up Yeelight

I’m having problems setting up a colour Yeelight (model YLDP06YL)

I’ve copied and pasted the recommended lines for Automatic Detection into the configuration.yaml file:

light.yeelight_color2_XXXXXXXXXXXX:
friendly_name: Living Room

But get the following error:
“Setup failed for light.yeelight_color2_XXXXXXXXXXXX: Integration not found.”

Additionally, I get an entry on the Lovelace ‘Living Room’ card, but instead of showing a light switch I get ‘Home’.

I was hoping to get a switch and also sliders to change the brightness and colour!

I’ve no idea where to look now - and a web search shows that several people have had problems in setting up this light but their solutions have not helped me. I could do with some advice, please!
Jim

I had issues then this works

Yeelight Auto Detection

yeelight:
devices:
xxx.xxx.xxx.xxx:
name: Light 1
xxx.xxx.xxx.xxx:
name: Light 2

That section isn’t for adding the lights to home assistant, it’s for customizing the friendly name (and other attributes if you want) after the lights have been discovered automatically. I can see how the wording related to that in the yeelight docs might be confusing though. That part is also supposed to go in customize.yaml, not configuration.yaml (as the docs state).

Check for the lights at developer tools > states and use the entity IDs you see there if you want to customize the friendly names for them. If the lights aren’t discovered automatically, you’ll need to configure them manually.

Both of you should also format your YAML properly whenever posting here by putting three backticks (```) above and below the sections of YAML.

Developer Tools->states show the only yeelight entity as being:

“device_tracker.yeelink_light_color2_miio134099964” and the state ‘Not Home’!

Thanks for the reply ‘Tediore’.
Jim

The Yeelight now reports that it’s ‘Home’!

I’ve got no idea what’s going on!
Jim

Sounds like you might need to manually configure the lights.

I set up my yeelights yesterday on my server, I just needed to put the following lines in the configuration.yaml file:


#yeelight
yeelight:
devices:
192.168.xx.xxx:
name: Light 1
model: color2
192.168.xx.xxx:
name: Light 2
model: color2

note that you must configure your router to provide each lamp with a fixed IP address, and you must also inform the model of the lamp you are using.

actually depends on the light. I don’t have to for mine:
yeelight.yaml

devices:
  192.168.1.66:
    name: YL-STUDY-CB1
  192.168.1.67:
    name: YL-FAMILY-CB1
  192.168.1.68:
    name: Study Desk Light
  192.168.1.71:
    name: RupusStripLight
  192.168.1.81:
    name: YL-SPARE-CB1
  192.168.1.82:
    name: YL-SPARE-CB2
  192.168.1.85:
    name: YL-RUMPUS-CB1
custom_effects:
  - name: 'Sunrise'
    flow_params:
      count: 1
      action: stay
      transitions:
        - RGBTransition: [255, 0, 0, 50, 1]
        - TemperatureTransition: [1700, 180000, 10]
        - TemperatureTransition: [2700, 180000, 11]
        - TemperatureTransition: [3700, 180000, 12]
        - TemperatureTransition: [4700, 180000, 13]
        - TemperatureTransition: [6500, 180000, 100]
  - name: 'Sunrise2'
    flow_params:
      count: 1
      action: stay
      transitions:
        - RGBTransition: [255, 0, 0, 50, 1]
        - TemperatureTransition: [1700, 10000, 10]
        - TemperatureTransition: [2700, 10000, 11]
        - TemperatureTransition: [3700, 10000, 12]
        - TemperatureTransition: [4700, 10000, 13]
        - TemperatureTransition: [6500, 10000, 100]
  - name: 'WarmOn'
    flow_params:
      count: 1
      action: stay
      transitions:
        - RGBTransition: [255, 255, 55, 50, 1]
        - TemperatureTransition: [1700, 10000, 10]
        - TemperatureTransition: [2700, 10000, 11]
        - TemperatureTransition: [3700, 10000, 12]
        - TemperatureTransition: [4700, 10000, 100]

I am setting the lamp up manually now:

yeelight:
  devices:
  192.168.1.47:
    name: Colour Lamp

The name is from that shown by the router, and the same as that displayed in the Overview:
“yeelink-light-color2_miio134099964”

The thing that confounds me is that it’s shown up in States as the entity:
“device_tracker.yeelink_light_color2_miio134099964” and it’s state is sometimes “Home” and sometimes “Away”. How can a light bulb be a tracker and either home or away?!

There’s something seriously wrong here!
Jim

Did you run a config check? If what you have there is what you put in your config, it wouldn’t pass a config check (indentation is off).

Also that device tracker entity is probably coming in from an integration that pings devices on your network

Do you mean the ‘Configuration Check’ addon? If so, it’s got a big green circle with a tick in it.
Also when I use the file editor, there’s a red circle with a cross if the syntax is wrong, which changes to a green tick if it’s correct. You can’t save and exit the editor without this green tick.

I’ve tried directly copying and pasting the example on the Yeelight page and only modifying the IP address and name, and it doesn’t make any difference. This is the setting I have now:

discovery:
  ignore:
    - yeelight
yeelight:
  devices:
    192.168.1.47:
      name: Test

Which doesn’t work!
Thanks for sticking with me, ‘Tediore’.
Jim

your spacing was wrong before. but your ‘Test’ version should work.

remove the - yeelight now and see if it works.

That works now - many thanks Jon.

The next thing I’d like to do is use it in an automation, but it looks like I can’t because it doesn’t have an I.D. as far as I can see - I can’t select it as a device in the automations U.I.

Jim

What do you want to do with it? If you want to turn it on/off, select “call service” as the action and use light.turn_on or light.turn_off with the light’s entity ID.

You can use any entity in an automation. Some integrations don’t support the concept of Devices, so you just can’t use the newer Device automations with those.

Got it!

‘call service’ was the answer.

Ultimately I want to control the light with a motion sensor - but I suspect that that’ll be a whole new can of worms!

(My main problem with HA is that I’m ‘winging it’. I really ought to spend time looking for tutorials. My other problem is that I’m 80 years old and not so mentally receptive to new concepts!)

Many thanks ‘Tediore’.
Jim

- alias: 'LIGHT: turn on the master-walk-in light when dark and movement'
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0002b441a6
    to: 'on'
  condition:
    condition: numeric_state
    entity_id: sensor.illumination_158d0002b441a6
    below: '25'
  action:
    service: homeassistant.turn_on
    entity_id: switch.0720009584f3eb85017d