r/Hubitat•
trevren11

Finally created a simple On/Off for my PC without virtual switches, Google Home compatible!

Premise: I had a pc for my plex server that I could turn on but never off with the Hubitat, it also didn't really do what I wanted out of the box, it required adding virtual switches and the state wouldn't be mirrored very well. It also didn't work with my google home so I rewrote some code I found for a good wake on lan driver and app and made it better

​

Features:

  1. Wake on LAN (no surprise there)
  2. Compatible with Google Home commands (and reflects them for the most part)
  3. Turns off pc (added a simple python server and scripts that allow you to turn your pc on and off forever, well sleep anyway)

​

2 and 3 are the differentiator here, there are several wake on lan drivers and apps, but none that I could find were compatible with Google integrations and nothing really had a good sleep option

​

Link to code:

https://github.com/trevren11/HubitatDrivers/blob/main/WakeSleepOnLAN/WakeSleepReadme.md

​

Basically what it does is you have a script that starts a simple python server to listen to off events, and the WOL is as expected, just sending a wake on LAN command when you turn it on. The script persists across startup and sleep cycles so you can keep running this `in aeternum `

​

​

Feel free to make feature suggestions or pull requests. I may add pinging to update the state but until that day, here is what I have

Also special thanks to Ramdev from whom I stole most of this code

Posted Jan 4, 2023, 6:16 PM UTC

61
Loading comments…