Monday, June 27, 2011

Twitter

Yesterday I mentioned that the home monitor can be commanded to periodically tweet its status, using the twitter name 'zouckhome'. The command to control tweeting behavior is actually 'Twit+' to turn it on, and 'Twit-' to turn it off. Here is the Tcl code fragment that processes incoming text messages and sets the variable 'twitterswitch' to 1 if the command 'Twit+' is received. 'twitterswitch' is tested periodically and if it is set to '1', a tweet with house status is issued:
 
        ## Twit+: Enable twittering status periodically and when alarms occur
        set regexp_twiton {(?:\A|\W)Twit\+(?:\Z|\W)}
        if {[regexp $regexp_twiton $body]} {
            puts "Enabling twittering"
            set response "$response (twittering enabled)"
            set twitterswitch 1
            regsub $regexp_twiton $body " " body
            incr commandsfound
        }
    
 
This code fragment is one of many in a procedure that processes every received text message. 

So, to enable tweeting, just send a text message from a phone or via email as described yesterday, with the string 'Twit+' anywhere in it. One way is to send an email with only the subject line:


Subject: Twit+



No comments:

Post a Comment