I wanted to publish some sensor data from my house up to pachube.
I used a venstar T1900 thermostat (http://venstar.com) along with insteon module from SmartLabs (http://www.smartlabsinc.com) over to a INSTEON controller connected to the Indigo software from http://www.perceptiveautomation.com.
First you need to create an account on pachube.com and create a new feed with two data streams. The first stream is temperature and second is humidity. Make sure the “Feed Type” is set to manual when you created the feed. From the pachube site, you need to get your API key and the feed ID for the feed you created. In the Indigo software, I created a “Time/Date Action” that runs ever 10 minutes and has an action type of “Execute AppleScript”. I use the following embedded script
The following code is license under the simplified BSD license (see http://www.opensource.org/licenses/bsd-license.php) if you want to use it.
# to use this script, you need to edit the next three lines with your API key, and URL for for your feed, and device name in indigo software for your thermostat
set myPachubeAPIKey to “PUT YOUR KEY HERE”
set myPachubeFeed to “http://www.pachube.com/api/feeds/1234.csv” # change to your key
set myThermostatName to “MainThermo” # you can find the name to put here in the Device screen in Indigo
tell application “IndigoServer”
set mainThermoDev to device myThermostatName
set myTemp to temperatures of mainThermoDev
set value of variable “mainTemp” to myTemp
set myHumidity to humidities of mainThermoDev
set value of variable “mainHumidity” to myHumidity
end tell
try
set myRes to do shell script “curl –max-time 10 –silent –show-error –request PUT –header ‘X-PachubeApiKey:” & myPachubeAPIKey & “‘ –data ‘” & myTemp & “,” & myHumidity & “‘ ” & myPachubeFeed
if myRes is not equal to ” “ then
log “Problem with posting to pachube. curl result is:” & myRes
end if
on error
log “Error execting curl to post to pachube.com: Result was ” & myRes
end try
#log “ran the temp log script temp=” & myTemp & ” humidity=” & myHumidity
You can get a google gadget on a web page to graph your feed by embedding the following code after changing the feedID from 1234 to whatever your feed is.
<script src=”http://www.gmodules.com/ig/ifr?url=http://apps.pachube.com/google_gadget/p.xml&up_feedID=1234&synd=open&w=400&h=300&title=House+Temp&border=http%3A%2F%2Fwww.gmodules.com%2Fig%2Fimages%2F&output=js”></script>
The end result should look something like: