Created
April 2, 2009 11:06
-
-
Save reddavis/89139 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'twitter' # sudo gem install twitter --#-- http://twitter.rubyforge.org/ | |
require 'open-uri' | |
require 'eeml' # sudo gem install Floppy-eeml --#-- http://github.com/Floppy/eeml-ruby/tree/master | |
loop do | |
# Pull in feed from pachube | |
data = REXML::Document.new(open("http://www.pachube.com/api/YOUR_FEED.xml?key=YOUR_SECRET_KEY")).to_s | |
# Parse the data | |
amount = EEML::Environment.from_eeml(data)[1].value | |
# Post to Twitter | |
Twitter::Base.new('dothegreenthing', 'PASSWORD').update("Twitterplug reading #{message} watts") | |
# Repeat every 5 mins | |
sleep(300) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment