This app allows you to remotely control your Windows machine by making web requests. You can lock, sleep, hibernate and shut down your PC from your phone, smartwatch, or any other connected device.
If you don't have an API key already, visit https://command.timsam.au/getkey to get an API key.
Then, create a system environment variable called WSS_TOKEN and set its value as your API key.
You can either download a pre-built release executable or download the source and build with stack build.
Goes without saying but if you're building from source you'll need the Haskell Tool Stack.
Simply double click the executable to run the program. The program runs silently, so no console window will pop up. In the folder where you started the program, there should be a text file called run.log. Open this file to verify that the program is successfully connected to the deployed API.
Here's a shortcut for your iPhone that will enable you to control your computer from your phone. Have your API key handy when you're setting the shortcut up.
Here's some code for an Alexa skill that you can deploy to control your computer by talking to Alexa.
The URL to send commands to is https://command.timsam.au/send/<command>.
- Replace
<command>with the command you want to send to the client.- ❗ The client will only respond to
sleep,shutdown,lockandhibernatecommands.
- ❗ The client will only respond to
- Place your API key in the
authpart of the header. - Send a
POSTrequest.
For example, if you wanted to send a sleep command and your token was fwolXHYtGMbmAg:
curl -H "auth: fwolXHYtGMbmAg" \
-X POST https://command.timsam.au/send/sleep
The API will return a status code and JSON indicating success or failure.
The program will automatically attempt to reconnect to the API if the connection is disrupted (eg. waking from sleep or hibernation), so you won't need to start it again every time.
Known limitation: If the connection is forcibly interrupted (ie. connecting to VPN, switching networks), then the client will fatally error out and you'll need to relaunch. This issue is under investigation.
If you want to make the program run when your computer starts up, place a shortcut to the executable in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp.
This project is a re-implementation of Pushbullet Automation, which is a Python project. I took a class on functional programming and decided it would be a good idea to re-write some of my older projects in Haskell.
This project orginally interfaced with the Pushbullet API but when I realised I could build out my own backend on AWS I re-wrote the client to make use of it. Here's the final release of this client that used the Pushbullet API. It should still work, but don't consider it supported. Any changes to the Pushbullet API would stand a high chance of breaking things (probably).
You can find the backend API infrastructure I built on AWS here.
For executing system commands I make use of the Windows API. This necessitates the use of the Win32 package, which is obviously limited to Windows systems. My main problem is that the Haskell Stack isn't very good at specifying conditional dependencies (see here, here), and any potential workarounds seem a bit iffy to me (like generating package.yaml on the fly after detecting the OS).
To be fair though, doing the above workaround isn't challenging at all, and neither is writing platform-specific code in Haskell, so Linux support is definitely something that could be easily implemented. I'll just have to get off my high horse. Eventually.