Cant get simple automation to work

Hey peeps

first of sorry i guess this has been up quite abit before… i have looked but didnt find any solution so i guess i will try and ask the pros! :wink:

ve just gotten hassio up and running with 2 Tasmotised Sonoff basics
just to learn ( and because i dont have other hardware to work with yet )

i wanted to make an automation that turns on switch 2 when i turn on switch 1… i just cant get it to work.
i have used the hassio interface to make it :smiley:

this is whats inside my Automation.yaml

- id: '1569779358554'
  alias: test
  trigger:
  - entity_id: switch.sonoff01
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - alias: 'switch.sonoff02'
    data:
      friendly_name: sonoff02
    service: switch.turn_on

can you enlighten me on what i have missed or doing wrong :smiley: ?

  action:
  - alias: 'switch.sonoff02'
    data:
      friendly_name: sonoff02
    service: switch.turn_on

That isn’t valid. You can’t control an entity by its friendly name, only by the entity_id. See the docs for some details.

  action:
  - service: switch.turn_on
    data:
      entity_id: switch.sonoff02

Of course it was that simple!

Thank you very much :slight_smile: