< async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"">

Monday, January 27, 2014

raspberry pi google talk remote control- controlling a pi with google chat message and chat bot

ADVERTISEMENT
raspberry pi google talk chat control
We use chat messages to communicate with our friends. Similarly we can use Google talk or other messengers like jabber/ aim /msn to control the Raspberry Pi. It is also possible to make it as an always on, automated chat robot which can respond to the commands. For instance it can respond with current room temperature, humidity or other sensor data. It is also possible to turn on lights , motors etc with a simple chat message!!

All these can be achieved with very minimal programming. There is a wonderful tool/application available on most of the linux distributions which can be used to perform the necessary commands via chat. It is called centerim. This is a command based chat program. To install this all you need to do is


sudo apt-get install centerim

Then start centerim by typing centerim

It can be configured for several chat services. For google talk the settings are as follows (choose jabber from the list)

jab_nick        [email protected]
jab_pass        yourPlaintextPassword
jab_server      talk.google.com:5223
jab_prio        4
jab_ssl         1
jab_status      o

For nerds the complete documentation can be accessed here

Achieve remote controle on the raspberry pi with chat

This is made possible via external actions in centerim. You need to edit and add your commands in the ~/.centerim/external file. Here is an example from centerim documentation which shows ls, free disk space and uptime. You can have your temperature reading script or the gpio controller to do the necessary actions!! To keep this program running all the time, a simple solution is to install screen.

sudo apt-get install screen 

Screen will keep your program running on the pi even after you disconnect your ssh! Now configure the ~/.centerim/external file and add the following (nano ~/.centerim/external ) Diverting the chat to a robot program like eliza can be used to make fun with your friends. Prefixing keyword with commands can be used to hide the control words. The possibilities are mind boggling and is left to readers imaginations. This post is just a pointer to the right direction !


%action         Remote control
event           msg
proto           all
status          all
options         stdin stdout

%exec
#!/bin/sh

case `cat` in
    ls) ls -l ~/.centerim/;;
    df) df -h;;
    uptime) uptime;;
esac

No comments:

Post a Comment