Wake on Lan my PC with Alexa

Hello everyone,

first of all. I am completly new to openHAB and it is very overwhelming.
I dont understand a lot at the moment, thats why I am asking for a bit of help :slight_smile:

My goal is to wake on lan my PC by saying something along of “Alexa turn on my PC”
I used to be able to do that with HA-Bridge but that somehow didnt work anymore, then I tried to set up a new SD Card and Alexa cant find my Devices anymore. Anyway, I now want to try this with openHAB.

I’ve read some documentation and some tutorials but all of those are a bit too complex for me to be honest.
Is there somewhere a step by step guide that I can go along or is someone nice enough to help me guide through this?

Thanks a lot in advance!
Fuschy

Welcome @Fuschy!

I would tackle this in two main steps:

  1. Use the wake-on-LAN binding, and make sure you can wake-on-LAN from a sitemap switch
  2. Add the Alexa integration

I can help with step number 1.

A note first, however: the Wake-on-LAN binding is a v1 binding. OpenHAB is currently at v2, so the Wake-on-LAN binding still works. However, soon openHAB will move to v3 - this issue tracks the status of existing bindings, and what will happen in v3. It looks like the Wake-on-LAN binding will be sucked into the Network binding, so we’ll still have a method to perform Wake-on-LAN. OpenHAB v3 is not out yet, though, so I merely note all this so you’re aware that in the future, if you upgrade to v3, you will need to make some changes again.

Install Wake-on-LAN binding

From the PaperUI, install the Wake-on-LAN binding. In a browser, go to the IP address of your device which hosts openHAB, at port 8080. If the device is the same one that you’re writing these posts on, just got to http://localhost:8080/paperui/.

Once in PaperUI, go to Add-ons, then click the Bindings tab. Find the WOL (Wake-on-LAN) Binding, and click install.

Create Item for PC

Create a file called wol.items, and save it in your openHAB items folder. In this file, add the following:

Switch sWoLPC { wol="192.168.1.255#d4:3d:7e:f2:36:30" }

Full configuration details are here, but essentially:

  • If your PC is at IP address 192.168.1.112 (for example), use the IP address 192.168.1.255 in the Item. If your PC is at 192.168.0.112, use 192.168.0.255 in the Item.
  • The part after the # is the mac address of your PC

Add switch to sitemap

We now need to add a switch to our sitemap. Open your sitemap file from the sitemap openHAB folder, and add the following:

Switch item=sWoLPC label="PC WoL" mappings=[ON="PUSH"]

If no sitemap file exists, you will need to start one. Name it strictly mySitemap.sitemap, save it in the sitemap openHAB folder, and add the following:

sitemap mySitemap label="mySitemap" {
   Switch item=sWoLPC label="PC WoL" mappings=[ON="PUSH"]
}

This will give you a button which says PUSH in your sitemap (address will be something like http://localhost:8080/basicui/app). Press that button, and the WoL packet will be sent.

Once you’ve got this working, then move on to the Alexa stuff. I don’t use it, so can’t help unfortunately!

1 Like

First of all. THANKS a lot for this part of the tutorial.
Is there a specific directory on the OpenHABian that I need to create those .items and sitemap files?
Cant quite figure it out of the documentations… Im a complete noob when it comes to Linux based systems…

Such stuff is documented:
Overview: https://www.openhab.org/docs/configuration/
https://www.openhab.org/docs/configuration/things.html#defining-things-using-files

Hmmm. You also could install OpenHab on a Windows system.
What would you do then ?

Alright, so I was able to create those 2 files now. I have the button on my Sitemap and I am able to turn on my PC with my phone.
Now I “only” need help with the Alexa Part…

Thanks A LOT for that documentation already. Was a huge part. Also learned a bit about the system through it :slight_smile:

1 Like

Well done though - that’s quite an achievement already! openHAB is extremely flexible, and therefore quite intimidating when first starting. I found examples far more useful than the documentation in trying to understand how everything works, so that’s what I try to provide when helping.

Good luck with the Alexa integration. I know there are many on here who use it, so you should be in capable hands!

Bumping so anyone might help me. Still havent been able to connect my Openhab Sitemap Items to my Alexa…

One way you could do it:
in Alexa app you can define your own routines. That means you can define a trigger ( a sentence that you say ) and an action that will be done. As action you can switch on / off switches that are available / visible by Alexa.
An other way ( not sure if that works with english sentences ): you can define a switch the name PC123 and turn it on from Alexa by “turn on PC123”. The related rule then needs to execute the WOL task.