send email if IP change or sendnormal email using RaspberryPi

sudo apt-get update
sudo apt-get install mailutils ssmtp
sudo nano /etc/ssmtp/ssmtp.conf
mailhub=smtp.gmail.com:587
AuthUser=yourgmailaddress@gmail.com
AuthPass=yourgmailpassword (do not use any # in your password!)
UseSTARTTLS=YES 
 


root:root@your.domain:smtp.gmail.com:587
www-data:yourwebpagesname@your.domain:smtp.gmail.com:587

root:yourgmailaddress@gmail.com:smtp.gmail.com:587
create file sendIp.sh and put

#!/bin/sh

SUBJ="This is new IP for Pi"
EMAIL="*****@gmail.com"

ip1=""
ip2=""

read ip1 < ip.txt
ip2=$(wget -qO- ifconfig.me/ip)

if [ "$ip1" = "$ip2" ]
then
  exit
else
  echo "$ip2" > ip.txt
  echo "$ip2" | mail -s $SUBJ $EMAIL
  exit
fi
 
 
 

save it.

sudo crontab -e
0,15,30,45 * * * * sh *full path to script here sendIp.sh &>/dev/null

Quick check: echo “Test text” | mail -s “Test Mail” targetperson@example.com

More tutorial  
  
Raspberry Pi Remote control:

Last of this tutorial you can control any remote control device with your voice.

I will try to describe every step to complete this tutorial.

Hardware:

1. Raspberry Pi
2. IR receiver
3. IR transmitter
4. WiFi module (optional)

Connection:

IR Receiver :                    

Data  --------------------------> GPIO18(PIN 12)
VCC   --------------------------> 3V (PIN1)
GND  --------------------------> Ground(PIN6)


IR Transmitter


Data  --------------------------> GPIO17(PIN 11)
VCC   --------------------------> 5V (PIN2)
GND  --------------------------> Ground(PIN14)


IR receiver and transmitter can buy from ebay and it's look like:
it's cheap, cost : C $3.29 










Software:

1. You need Raspbian. 
2. For IR device:

First, we’ll need to install and configure LIRC to run on the RaspberryPi:
sudo apt-get install lirc
Add this to your /etc/modules file:
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22

Change your /etc/lirc/hardware.conf file to:
########################################################
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="--uinput"

# Don't start lircmd even if there seems to be a good config file
# START_LIRCMD=false

# Don't start irexec, even if a good config file seems to exist.
# START_IREXEC=false

# Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
########################################################
Now restart lircd so it picks up these changes:
sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start

Testing the IR receiver

Testing the IR receiver is relatively straightforward.
Run these two commands to stop lircd and start outputting raw data from the IR receiver:
sudo /etc/init.d/lirc stop
mode2 -d /dev/lirc0
Point a remote control at your IR receiver and press some buttons. You should see something like this:
space 16300
pulse 95
space 28794
pulse 80
space 19395
pulse 83
space 402351
pulse 135
space 7085
pulse 85
space 2903
If you don’t, something is probably incorrectly configured. Triple check that you’ve connected everything properly and haven’t crossed any wires. I highly recommend referring to the schematics I linked to above. There is also some trouble shooting advice in the RaspberryPi Forum thread I linked to above. Finally - you may want to do this in a dark room. I found that my desk lamp and overhead light would cause the IR receiver to think it was receiving valid signals.

 

Wiring up the IR transceiver

The /etc/lirc/lircd.conf file tells LIRC about your remote control. Since every remote control is different, you need to generate a different config for each remote. Alternatively you could try and find your remote control config file here: http://lirc.sourceforge.net/remotes/.
To generate your own configuration run:
$ sudo irrecord -f -d /dev/lirc0 /etc/lirc/lircd.conf
and carefully follow the on-screen instructions. At some point it will ask you to enter the commands for each button you press. You can list the available commands (in another terminal) with:
$ irrecord --list-namespace
After you have finished, restart the lirc daemon (or reboot) and test your remote by running:
$ irw
Your commands should appear in the console.

 

Testing the IR LED

You’re going to need to either find an existing LIRC config file for your remote control or use your IR receiver to generate a new LIRC config file. In my case I created a new LIRC config file. To do this, read the documentation on the irrecord application that comes with LIRC.
When using irrecord it will ask you to name the buttons you’re programming as you program them. Be sure to run irrecord --list-namespace to see the valid names before you begin.
Here were the commands that I ran to generate a remote configuration file:
# Stop lirc to free up /dev/lirc0
sudo /etc/init.d/lirc stop

# Create a new remote control configuration file (using /dev/lirc0) and save the output to ~/lircd.conf
irrecord -d /dev/lirc0 ~/lircd.conf

# Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf

# Start up lirc again
sudo /etc/init.d/lirc start
Once you’ve completed a remote configuration file and saved/added it to /etc/lirc/lircd.confyou can try testing the IR LED. We’ll be using the irsend application that comes with LIRC to facilitate sending commands. You’ll definitely want to check out the documentation to learn more about the options irsend has.
Here are the commands I ran to test my IR LED (using the “yamaha” remote configuration file I created): yamaha or /home/pi/lircd.conf
# List all of the commands that LIRC knows for 'yamaha'
irsend LIST yamaha ""

# Send the KEY_POWER command once
irsend SEND_ONCE yamaha KEY_POWER

# Send the KEY_VOLUMEDOWN command once
irsend SEND_ONCE yamaha KEY_VOLUMEDOWN
I tested that this was working by pointing the IR led at my Yamaha receiver and testing whether I could turn it on and adjust the volume.
DIRECTIVE can be:
SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event

Success!

That’s it! You’ve now successfully installed and configured LIRC on your RaspberryPi. You can add additional remote control configuration files to your /etc/lirc/lircd.conf file to control multiple remotes.
 Setup voice command:




openelec config

change farenheit to celcius openelec
settings -> appearance-> international-> region 

http://www.raspberrypi.org/forums/viewtopic.php?f=35&t=17812