Remote control your RaspberryPI from Twitter.
RPiTwit is a really simple script to execute remote shell commands on your RaspberryPI (or any other Linux distribution with python) using your twitter account.
To execute commands just write a status on your twitter with the following format:
#RPITwit <command> [arguments]
The scripts are stored on “~/rpitwit_commands/”. You can call python scripts, shell scripts or executables. In the case of python scripts do not include the “.py” extension when calling the command on twitter.
If you have setuptools installed just run (as root):
sudo easy_install rpitwit
If not, download the tar.gz package, extract it and run:
sudo python setup.py install
Running on Raspberry PI (Or any other Linux distribution)
IMPORTANT: Never run rpitwit as root.
Execute the following command:
And follow the instructions.
To stop press Ctrl+C
If you feel nervous or don’t want to come here again to read the instructions, you can ask for help with the following command:
This is going to show you a really small help text with the command line options that you can use on RPiTwit.
The first time that you run rpitwit it’s going to ask your authorization on twitter, just follow the instructions.
Important note: RPiTwit NEVER is going to ask you for your password or email, all the authentication is done on Twitter and they are going to generate for you a “PIN” that you need to enter when it’s asked.
After you authorize the apllication on twitter, the script is going to ask you for the twitter usernames who are going to be able to execute scripts. For security don’t allow access to unknown people.
The configuration options are stored in ~/.rpitwit_config
You can modify the following options:
- magicword: keyword used to run commands, this must be
- the first word on your tweet.
- follow: list of twitter user IDs that who are going
- to be able to execute commands.
- AppName: Name of the application on Twitter. Do not
- modify unless you are using your own keys.
oauth_token: generated automatically. Do not modify.
oauth_secret: generated automatically. Do not modify.
If you are using your own application keys you MUST add this three lines to your ~./rpitwit_config file:
AppName=<your twitter application name> CONSUMER_KEY=<your twitter application key> CONSUMER_SECRET=<your twitter application secret>
Now you need to start rpiwit with the “–reload-tokens” argument to update the authorization tokens:
For more info about generating your application keys look under the documentation directory.
This is very simple tool that just executes shell and python scripts contained within the script directory.
It doesn’t limit what the commands could do to your system. Do not run rpitwit as root, and try to not give root access to the scripts with “sudo” or “su -c” unless completely necessary.
Be really careful, don’t put dangerous commands or scripts from untrusted sources inside the command directory.
From 0.1.0 to 0.2.0:
- The script now captures SIGINT and SIGTERM and closes without giving errors when you press CTRL-C or using the kill command.
- Added the “–about” argument to show copyright info.
- Added the “–help” with a really small help text.
- Added the “–load-defaults” argument to load the default config. If you screw up the configuration try with this argument.
- Added the “–reload-tokens” argument to update the oAuth tokens in case of using custom application keys.
- Added the “–ask-follow’ argument to change the list of users that rpitwit follows after the first run.
- A lot of code cleanup. Comments added. Now it’s more easy to read and understand.
- Initial release.
Credits and more Info
This software uses the TwitterStream API from Python Twitter Tools by Mike Verdone (mike.verdone.ca) (http://pypi.python.org/pypi/twitter)
A more detailed explanation of usage and examples: