Wake on LAN and switches.yaml *Newbie*

I started my HA journy a couple of days ago and there’s been a lot to learn, but now I am stuck at wake on LAN and switches.yaml.
I have started using IoTlink to monitor my pc and push command such as display off, shutdown, hibernate, etc… and it has been working wonderfully, but now I would like to be able to wake my pc up, after some googling and researching I found that wake on LAN is what I seek.

I tried following https://www.home-assistant.io/integrations/wake_on_lan

and Use home assistant to turn your computer on and off | JuanMTech

But I can’t get it to work, I have wake on lan enabled in my network adapter and BIOS on PC.

I also don’t have and can’t create a switches.yaml
when I try to create a new .yaml named switches through visual studio code and use !include in configuration.yaml I get the error below when checking the configurations.

Component error: switches - Integration ‘switches’ not found.

Current segment of configration.yaml


group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switches: !include switches.yaml

wake_on_lan:
  # Wake on LAN - paper
  - platform: wake_on_lan
    name: "Wake-up Pokeball PC"
    mac_address: "1A:2B:3C:4D:5E:6F"
    host: 192.168.107.70

I tried moving the paramaters to switches.yaml but I can’t because of the error above, so now I have the configuration in configuration.yaml and then use a script to call it but with no luck.
script is below:

wakeup_pokeball_pc:
  sequence:
    - service: switch.turn_on
      entity_id: switch.wakeup_pokeball_pc

Could someone explain to me why would it not be working? and also how can I split my configration.yaml and other files such as shell.yaml, switches.yaml, etc

Try switch: !include switches.yaml in your configuration.yaml

Thank you, this does solve the switches.yaml issue but sadly wake on lan still does not work…

I figured out that my issue was that my PC is for some reason not keeping my network card up during “Hibernate, Sleep, Suspend” statuses, but it does keep it alive during “Shutdown” status so weirdly I can wake the PC up only from shutdown.

This part goes into the switches.yaml file:

  - platform: wake_on_lan
    name: "Wake-up Pokeball PC"
    mac_address: "1A:2B:3C:4D:5E:6F"
    host: 192.168.107.70

In configuration.yaml you only need this:

wake_on_lan:

In case anyone stumbles upon this, the solution was 3 folds
1-

2-

3- follow this guide (works on windows 10): Microsoft doc for power management for network adapter
more specifically this section

3 Likes

Just commenting to say for others: you don’t need to have a separate switches.yaml file. Make sure the indentation is similar to below. All in the configuration.yaml:

wake_on_lan:
# no child items, or you will get an error
# "The wake_on_lan integration does not support any configuration parameters"

switch:
    platform: wake_on_lan
    name: "Wake-up Pokeball PC"
    mac: "1A:2B:3C:4D:5E:6F"
    host: 192.168.107.70
1 Like