How to turn on specific light with a XIAOMI Switch?

Hi,

I created my first automation (i have similar to on)

Which created this:

   - action:
  - alias: ''
    data: {}
    - service: light.turn_on
      data:
        entity_id: light.yeelight_rgb_7811dca6009f
  alias: BotaoSala
  condition: []
  id: '1524512413200'
  trigger:
  - event_data: {}
    event_type: click
    platform: event
- action:
  - service: light.turn_off
      data:
        entity_id: light.yeelight_rgb_7811dca6009f
  alias: botaosala2
  condition: []
  id: '1524513060972'
  trigger:
  - event_data: {}
    event_type: click
    platform: event

Problem is, it turn on all my lights. How can I specify which light to enable?

Can you please post the complete automation from the yaml. It seems that your post is incomplete.

Make sure that the entity_id of your light is correct, this is where you specify which light to turn on /off.

Meanwhile, you can try to manually launch the corresponding service (Developer Tools -> Services)
Look for the “light.turn_on”, then choose your light to be turned on. The page will automatically fill out the correct Service Data Json which you must use in your automation.