Turn ON/OFF PC with Aqara Button

Hello there,
I got a question which might be easy to answer…

I created the following within configuration.yaml …

switch:
  - platform: wake_on_lan
    mac: 1A-2B-3C-4D-5E-6F
    name: MyPC
    host: xxx.xxx.xxx.xxx
    turn_off:
      service: hassio.addon_stdin
      data:
        addon: core-rpc-shutdown
        input: MyPC

… which I can use with a button card to turn on my pc. Now I want to use a zigbee connected aqara button to turn my pc on. For that, I guess, I need an automation.

Since I don’t know how to use my already existing switch I’ve created the automation to call the service “WOL” as following:

alias: StartPC Button
description: ""
trigger:
  - device_id: 3dd09267d770e96fd468df7de8c04925
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: remote_button_short_press
condition: []
action:
  - service: wake_on_lan.send_magic_packet
    data:
      broadcast_port: 9
      mac: "1A-2B-3C-4D-5E-6F\t"
      broadcast_address: xxx.xxx.xxx.xxxx
mode: single

Result: Nothing happens using the aqara button. Anyone got a clue? :slight_smile:

THANKS ALOT!

Deen

I got it already :smiley:

Solution:
Within the automation use service and “switch.turnon”.

alias: StartPC Button
description: ""
trigger:
  - device_id: 3dd09267d770e96fd468df7de8c04925
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: remote_button_short_press
condition: []
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.wol_mypc
mode: single