Want to be able to wake up your PC at home while outside your home network? TweetWake monitors your Twitter account and can send a wake-on-lan packet when a tweet is detected on your timeline.
- Can run on a low-power device, such as a Raspberry Pi, allowing you to save energy by letting your desktop sleep
- Enable remote desktop apps to start up and become available
- No external static IP configurations from your ISP
- Avoid network vulnerabilities associated with opening your home network to the internet
- Send a Tweet using any device using your monitored Twitter account. The Tweet can have any text you want.
- The script runs on an interval to query Twitter pull the home timeline for a specified Twitter account every minute
- If any tweets are detected in the past X minutes, send a magic packet to the specified MAC address on your home network
- Schedule as a cron job to adjust the polling interval (recommended once per minute)
- Create a Twitter application with your Twitter developer account. Credentials are required to use Twitter's API. More Info
- Clone the repository to a location on your machine, or the device you will run it on
git clone [email protected]:maxrjohnson23/tweetwake.git
- Copy/rename the file
sample_config.py
toconfig.py
- Edit
config.py
and add the following- Twitter API credentials
- Twitter handle (your account that you would like to poll)
- The MAC address of your device to wake.
Note: This device must be on the same network and have wake-on-lan enabled in the BIOS and wake-on-magic-packet enabled in the network device driver: setup instructions - Detection window in minutes. On each run the script will check for a tweet within the past X minutes
-
ssh into your Raspberry Pi using the devices IP address:
-
Make sure python3 and pip3 are installed:
sudo apt-get update && sudo apt-get install python3 && sudo apt-get install python3-pip
-
If you downloaded the files to your main computer, you will need to copy them to the Raspberry Pi home directory
-
From your main computer, navigate one folder up from the cloned repository. You should be able to see the
tweetwake
folder -
Run the copy command to transfer the files to the Raspberry Pi using the correct path and IP address
scp -pr <DESKTOP-FOLDER-PATH>/tweetwake/ [email protected]:/home/pi/tweetwake
-
You should now have all the same contents available in
/home/pi/tweetwake
on the Raspberry Pi
-
-
Navigate to the folder
/home/pi/tweetwake
. Run pip install to pull the script's dependenciespip3 install -r requirements.txt
-
Update your cron configuration to run the script every minute. This appends an entry if there are existing cron jobs. This causes python3 to execute the script every minute and output the log to
/home/pi/tweetwake/log.txt
(crontab -l && echo "* * * * * python3 /home/pi/tweetwake/tweetwake.py > /home/pi/tweetwake/log.txt") | crontab -
- View the contents of
/home/pi/tweetwake/log.txt
for any errors usingcat log.txt
- Ensure the script is configured to run every minute. You can run
crontab -l
to view the file. There should be an entry:* * * * * python3 /home/pi/twitterwake/tweetwake.py > /home/pi/twitterwake/log.txt
- Make sure your
config.py
file has the correct credentials and settings - Make sure your computer is enabled for wake-on-lan: setup instructions