rSOL – Remote Sleep-On-LAN


So it’s been a while since I’ve posted something. I’ve been busy with work. So the latest project that I’m currently working on is related to my Home Automation project. After testing and searching for the best suitable option, I have decided to proceed on using Home Assistant as the controller for my smart home project.

A bit about Home Assistant


Home Assistant is an open-source home automation platform running on Python 3. Track and control all devices at home and automate control. Perfect to run on a Raspberry Pi.

Taken from


I like the way that Home Assistant auto discovers new devices. Other Smart home software requires that you manually configure devices. This is a bit of inconvenience to me. A smart home solution should be smart enough to be aware of its perimeter.

So I had a few devices around the house but this is about the Plex Media Server that is running on my windows machine. I needed a way to remotely turn on and off the machine using my Home Assistant Controller (HASS). To turn on the machine, I can use Wake-On-LAN protocol to easily turn on any device on the network. On Linux, it works flawlessly but in Windows, there are some limitations.

Read more about this here


For turning off or putting the machine to sleep, I need to have a tool that can turn off / put the machine to sleep via a remote command from the HASS controller. After a bit of research I came out with a solution that will

  1. Run as a windows service
  2. It will listen for a http connection
  3. If the MAC Address of the originating command request is allowed, then the machine will then execute the command.

As of now I have 4 commands, lockwin ( to lock the machine ) , startplex ( start PlexService ) , stopplex ( stop PlexService ), tdola ( puts the machine to sleep ). It can actually be used to control any other services or commands.

I have created a repo on Github for this. It is coded in Javascript for Node JS. Check it out.

You can compile it and ran normally or you can run it as a windows service using nssm / srvany or node-windows. Personally I prefer to bundled it into a single exe using pkg ( and then run it as a service using nssm (

You can read more at github.

This is my switch configuration .yaml

- platform: wake_on_lan
  name: DH3C-ROG WOL
  mac_address: "XX:XX:XX:XX:XX:XX"
      service: shell_command.turn_off_mypc

- platform: command_line
      command_on:  'curl'
      command_off: 'curl'

  turn_off_mypc: 'curl'

Go to the main page of Home Assistant and 2 new switches will be shown like this.