Monday, April 03, 2017

Alexa, Turn on Computer

There is many ways to wake your computer up and put your computer to hibernate using Alexa.

I will use:

1. computer with cygwin enabled with sshd service
2. domoticz on a raspberry pi
3. ha-bridge on raspberry pi
4. Amazon echo

I'm more of a computer user than a developer, but I find that Domoticz is great as it helps non-developers download unix commands and allow a direct call to shell scripts.

More great things about Domoticz is that it convert HTTP POST to GET methods when you are using triggers that can't do POST to Philips Hue lights (I will cover that in another post)

Step 1: Setup a dummy hardware used for virtual switches

Step 2: Create a virtual sensor as a light switch called Computer

For the On script use:

The bash script should contain

wakeonlan  BC:5F:F4:88:92:B6

For the Off script use:

This bash script contents are; (Replace X with the IP address of the computer)

ssh user@192.168.1.X "shutdown /h" &

The off switch assumes you have an sshd service running on your computer with private keys installed on the raspberry pi with no password so it auto autenticates and runs without entering a password. Windows 10 command to hibernate is shutdown /h

You will need to google again to find out how to setup sshd, as it's too long to put into this post.

For ha-bridge to use this, add the domoticz command to Computer (Replace NN with switch ID, you can get this from the devices tab under the "Setup" drop down.



To use

Alexa, turn on computer
Alexa, turn off computer

No comments:

dead pi

Well, I guess it has to happen at some point. the home automation raspberry pi has died. Much to do with the stupid Strontium mini SD card. ...