One thing that I've noticed since getting heavily into home lab experimentation is that my home electricity bills are trending upward. On any given day, I could have several servers running, plus assorted network appliances and client devices. It's not just the power to run these, especially in the summer; there's a corresponding increase in the amount of time I need the air conditioning to run; otherwise, my office will turn into a sauna.

The only things I really need to stay on overnight are my NAS and the virtual machines running on it, because that's where Home Assistant lives, and my smart home is better for it. That got me thinking. Can some Home Assistant automations handle my home lab for me, so that I can turn things off at night, but have them running in the morning for work before I get back downstairs? The answer is yes, mostly, and it wasn't that difficult to set up.

My home lab is not a datacenter

It can sleep when I do

I know some home lab enthusiasts love having their ex-enterprise hardware running constantly, chasing that perfect uptime score. I used to be like that, but as my home lab has grown, I find that switching things off when nobody in my home is using them is cathartic. Plus, any cost savings I make on electricity consumption can be funneled back into more hardware, and that's an attractive thought.

That's not to say I won't keep some things running when I'm doing longer experiments, but most of the time I power down my home lab before heading to bed. The only exceptions are my NAS devices, which stay on to handle backups and other tasks while the network is otherwise unused.

I always keep Home Assistant ticking over

I'm a full convert to the power of Home Assistant, whether it's adding automations for regular tasks, tweaking my smart home dashboard for usability, or the simplicity of removing most other smart home apps from my phone. It's controlling my smart home, monitoring it, and actively keeping it secure, which means it's always available to add useful things.

That's also why it lives in a virtual machine on one of my NAS boxes; those never get turned off, so it makes sense to combine them. I could have Home Assistant running on its own machine, but then it adds complexity and hardware running constantly. Since HA is always on, it also makes sense that any automations to wake my home lab also live inside, and that's what I've put together.

Home Assistant
OS
Windows, macOS, Linux
iOS compatible
Yes

Home Assistant can wake my home lab before I get out of bed

Nothing beats having an extra few minutes to brew some coffee every morning

Home Assistant has been integrating my smart home for a while, but I'm only starting to explore automation. I didn't want to start before I understood how things worked a little better, mainly because if something breaks, it's more visible if it's a smart device used by the rest of my family, compared to something limited to my home lab.

I've been using HASS.Agent to turn off my desktop PC at night when it's not being used, and I wondered if I could do something similar for my home lab. I don't have enough smart plugs (yet) to put one on every home lab device, but I don't want to either, as an unintended shutdown could lead to data loss. It's better if I keep shutdown tasks as a manual process, and then automate the booting up process so that everything is running again when I need it for work.

I'm sure I will add graceful shutdown automations into the mix at some point, but for now, I don't want to add too many complexities until I'm more comfortable with the process.

Wake-on-LAN is part of the puzzle

The Wake-on-LAN (WoL) integration in Home Assistant is one of the easiest things I've set up on the platform. All I needed was the MAC address of my server to ensure WoL was enabled in the BIOS of that machine. Then it's a simple enough automation call comprised of a time trigger that goes off at the same time every weekday, and an action chain with the sending of the magic packet to the correct MAC address.

automation:
- triggers:
- trigger: time
at: "06:30:00"
weekday:
- "mon"
- "tue"
- "wed"
- "thu"
- "fri"
actions:
- action: wake_on_lan.send_magic_packet
data:
broadcast_port: 9
mac: 00:11:22:33:44:55

I've got one automation per device, and then a grouped script that sends them off, spacing the magic packet for each subsequent device one minute later, so there's a gradual increase in the power draw to my office.

And the Proxmox integration wakes up my VMs

Setting up Home Assistant to control my Proxmox servers was almost as simple. I needed an access token from the Proxmox UI, to add the Proxmox integration's repository, install it, and then connect the two. The card added to the dashboard shows if Proxmox has updates waiting to be installed, and the Devices & services tab has all the details I need to set up automations to start my VMs before I get to the office.

After the magic packets are sent, I've got a similar YAML to the entries below to start the VMs. Remember that Proxmox VMs are called by their number, and getting the rest going in the order you need is simple.

 # Wait for hosts to boot
- delay: "00:02:00"
# Start critical VMs via Proxmox
- action: button.press
target:
entity_id: button.proxmox_vm_101_start # Database VM
- delay: "00:01:00"
- action: button.press
target:
entity_id: button.proxmox_vm_102_start # Application VM

I haven't gone into a similar shutdown script, partly because I'm about to migrate to a more powerful machine to host Proxmox and the VMs, and I don't know if I'm going to keep the VMs I have set up in their order and configuration. Once I've settled on that, I'll be adding a script to check if it's working hours, which then triggers the wake-up process if the server and VMs aren't running, and scripts to gracefully shut everything down at night if they're not actively being used.

Home Assistant can do more than control your smart home

The neat thing about Home Assistant is how powerful a platform it is for creating automations to make your life easier. It's running my smart home, my home lab, and checking my calendar to remind me of events and things I need to do, and that's just a small part of what it can do. I'm not sure any one company will build the smart home of my dreams, but maybe I can build it myself with a little help from Home Assistant.