This project extends the ability of smart homes by creating an almost real time SMS to RaspberryPi connection. In this sample repo, a LED is coded in to activate from Raspberry Pi's GPIO04 pin once the SMS message "LED on" is sent to a specific phone number, and could be turned off by texting "LED off".
Please install the following prior launching the application.
- ngrok at step 7
- Signup for Twilio and get their auth ID's after signing up for a free trial of a phone number. (Public and Private)
- Replace the corresponding constants in src/main/java/ui/Main.java with the auth ID's.
- Connect your LED to GPIO04 with the pin numbering scheme
- Open a terminal inside the first layer of HomeParser directory and type
mvn clean package
followed bymvn install
to create a executable .jar file inside target/ - run
sudo java -jar target/maven-1.0-SNAPSHOT.jar
in the same terminal - A web server should now run on localhost:4567
- Port forward or use ngrok -> In your installation directory of ngrok, run
./ngrok http 4567
. ngrok should then give you a web address, save this. - On Twilio, click on your active number and go into configure, scroll all the way down to the messaging part and paste in
http://[ngrok address from step 7]/sms
orhttp://[your port forwarded address]/sms
. - Text "LED on" or "LED off" to the Twilio active number and watch your LED turn on.
To be finished.
Example:
In short: The SMS, "LED on" sends to a Twilio phone number and they send a webhook (POST) to a Raspberry Pi's Spark web server, the Raspberry Pi at home then parse it and set output of its corresponding pin to high and lights up the LED.
-Spark
-Pi4J
-Twilio
-Maven
-Raspberry Pi
-Maven
-SSH
-Bash
-Port forwarding
-Spark (Java web server)
-Pi4J (Raspberry Pi for Java)
-Webhook technology
Project compiled with Maven.