In my previous post Forget_me_not : My Smart Home Post#4 Week-3 Pi, Enocean Sensors, openHAB, remote URL and email notification I have shared working with enocean sensors, OpenHAB, Remote URL and Email notifications setup.
In this week I have designed Smart mailbox with twitter and email notifications for my project “My Smart Home”.
I have implemented twitter action as steps given in this link....https://github.com/openhab/openhab/wiki/Actions
In raspberyy-pi I cant manage to get authantication from twitter using these steps.. But I am able to get authentication from twitter using same steps on openHAB running on my windows laptop.
Simply I have copied openhab/etc/twitter.tokan file generated after successful twitter authentication from my windows laptop to same location on raspberry-pi.
Bingo...!!! every thing works great.. but suddenly I have noticed that Twitter not allows to tweet same message... so every tweet should be unique..
So finally I have decided to use time stamp with my tweet which is obviously unique and meaningful to..
My mailbox prototype is only for demonstration, I will be buying real mailbox and will use enocean reed contact sensor with that mail box..Also I am planning to put another enocean reed contact sensor at back of mailbox where mail collection door is located.
So for every new mail I will be getting notification with count of new mail in my mailbox and when mail collect door opens these count automatically reset to zero.
Here is short demonstration of Smart Mailbox with tweet and email support
Here are some build and setup pics...
As you can see in Android screen shot of email and twitter notification, twitter notification is very fast compare to email notifications, almost there is two minute difference between email and twitter notification.
Here is my demo.rules file
import org.openhab.core.library.types.* import org.openhab.core.persistence.* import org.openhab.model.script.actions.* import org.openhab.binding.* import org.openhab.action.* import org.apache.commons.mail.* import java.util.Date /** * This rule sends email and tweet to home owner when doorbell switch pressed with photo as attachment * here execute command line is just for demo it actually takes photo from PI Camera and save this image in specified folder * So far I am waiting for PI camera so its not implemented */ rule "send mail doorbell" when Item EnOcean_switch_A received update ON then var String tweet_doorbell="Doorbell:You have new visitor at home (" + new Date + ")" sendTweet(tweet_doorbell) sendMail("ravi.butani03@gmail.com", "My Smart Home (Doorbell)" , "You have a visitor...!!","http://localhost:8080/images/ondoor.png") executeCommandLine("/opt/openhab/a.out") end /** * This rule sends email to home owner when new mail dropped in mail box */ rule "send mail update Mailbox " when Item EnOcean_contact received update OPEN then var String tweet_mailbox="Mailbox : You have new mail (" +new Date + ")" sendTweet(tweet_mailbox) sendMail("ravi.butani03@gmail.com", "My Smart Home (New Mail)" , "You have new mail in your mail box...!!") executeCommandLine("/opt/openhab/a.out") end
I am using java.util.Date package to get time stamp....
And I have Good news, I have received Tek Scope and Enocean Programmer with few of other Parts...Now I can move ahead much faster with received parts.
Top Comments