Turning the PC on and off

I have a switch for pc management in configuration.yaml

wake_on_lan:

switch:
  - platform: template
    switches:
      pc:
        value_template: "{{ is_state('binary_sensor.pc', 'on') }}"
        turn_on:
          service: wake_on_lan.send_magic_packet
          data:
            mac: 2c:f0:5d:79:af:cb
            broadcast_address: 192.168.255.255

        turn_off:
          service: shell_command.disable_pc

turning off the PC works fine, but there is no turning on. moreover, if you run the command wake_on_lan.send_magic_packet in the developer panel, then everything seems to work.

What is the problem?

There is a WoL switch platform:

switch:
  - platform: wake_on_lan
    mac: "2c:f0:5d:79:af:cb"
    host: <ip_address of PC here>  # this will be used to get the switch state
    turn_off:
      service: shell_command.disable_pc
1 Like

This :

you don’t say what OS is the PC running.
Typically on Linux you need to use ethtool to activate WOL every time you plan to use it because the setting is lost at each reboot.
It also depends on your network card/driver.