PROJECT
PC Notifications
Project Overview
For a while, I’ve had a setup on my main PC that allows for the use of wake on LAN. This allows me to turn on my PC from my phone which is very handy. However, whether I’m using wake on LAN or simply turning on the PC by the button, I don’t know when the PC has fully booted and I can use it. This project aims to solve this issue by giving me a phone notification when the PC is fully booted.
Pushbullet
The notifications will be sent using Pushbullet. The app itself has more features than just this, and even without integrating it into a Python script, it’s still a useful app.
You’ll need to sign up for Pushbullet before we can integrate it into a script.
API Setup
Go to Settings > Account.
Under Access Tokens, click on ‘Create Access Token’. This will give you a code. You’ll need this for the script so keep it open.
Pushbullet.py
We’ll be using this module to do the heavy lifting: https://pypi.org/project/pushbullet.py/0.9.1/
You can check their documentation for further usage yourself. You will also need to install this on your phone through the relevant app store.
The Python Script
Make a new python script; I called mine ‘notify_computer_on.py’.
We import the ‘pushbullet’ module and the ‘datetime’ module. Pushbullet sends the notifications and ‘datetime’ will return the exact time our PC became usable.
We then create a variable “now” which will return the timestamp of when it was created.
Then, we define a function to send the push notification by using the push.push_note method using your api token from earlier.
Finally, we call the function.
Finishing up
Finally, we place this script in the startup folder of the PC. Click on the search bar and type “run”. Then open “shell:startup” and the startup folder will open.
Place your script in this folder. When the PC turns on and is usable, it will run through the contents of the startup folder, execute your script and send you a phone push notification to say the PC is usable. Finito!