Post

HA Power Control + Wake-On-LAN = Magic

After all my recent Proxmox updates and the main new host/server I went on a deeper dive to look at ongoing power consumption for all my tech in the house. I accomplished this with HA and mostly Shelly switches (along with some rather cheap Meross outlet switches as well).

During my deeper analysis on my main office computer rig (which now has 6 screens), I noticed that the screens pull ~45w while idling and the PC is off.

This prompted an automation to turn off the ‘office rig’ outlet after a minute of the outlet pulling <50w.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
alias: Turn off rig after Shutdown
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.smart_plug_2309065864092251070xxxxxxxxxxxxx_power
    for:
      hours: 0
      minutes: 1
      seconds: 0
    below: 50
conditions: []
actions:
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      device_id: 5912568a1fb1b68a2dxxxxxxxxxxxxxx
mode: single

This works all well and good, but it still requires me to go and manually turn on my office rig PC within a minute of turning the Office Rig power outlet back on. Not a big deal but a bit annoying.

Last night I had the idea of trying to use Wake-On-LAN to get the office rig to turn on a few seconds after the Office Rig outlet. Turns out this was super easy to achieve in HA:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
alias: Turn on Rig
description: ""
triggers:
  - trigger: state
    entity_id:
      - switch.smart_plug_2309065864092251070xxxxxxxxxxxxx_outlet
    to:
      - "on"
conditions: []
actions:
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - action: button.press
    metadata: {}
    data: {}
    target:
      entity_id: button.wake_on_lan_04_d9_f5_xx_xx_xx
mode: single

After putzing around in the BIOS to find the WOL settings and ensuring that Wake-on-LAN/Magic packet was enabled in Windows, I now have the Office Rig powering up when I turn on the outlet.

To be honest, this is probably one of the most useful automations to date. The ability to turn on my Office Rig while I am making coffee first thing and it will be at a login prompt right when I get into the office upstairs it pretty magic.