Last week, I found, and borrowed, a Python class that makes it easy to update a Cosm (Pachube) feed. I'm using it to upload current temperature data for the two (upstairs and basement) Filtrete 3M-50 Wifi thermostats in our house. I'm also grabbing outside weather data (temperature and barometric pressure) from Yahoo and adding that too. It's working great.
This was an upgrade/change from a similar arrangement where I was uploading the same data to ThingSpeak, but I found that the ThingSpeak GET calls weren't making it to the data stream. After a couple weeks trying to troubleshoot, I eliminated every potential problem except ThingSpeak itself. I gave up and went to this setup...it hasn't missed even one time.
So, the arrangement is to place the following Python script in a folder, make it executable, and place the PachubeFeedUpdate class in there with it. I set up a cron job that runs every two minutes and executes the script.
Here's the resulting Cosm feed: https://cosm.com/feeds/70837
#!/usr/bin/python
import urllib2
import json
import datetime
from PachubeFeedUpdate import PachubeFeedUpdate
# get the temp information from the thermostat
url='http://LAN_THERMOSTAT_IP/tstat/'
response = urllib2.urlopen(url)
json_string = response.read()
parsed_json = json.loads(json_string)
current_temp = parsed_json['temp']
### update Pachube/cosm with the data point
pa_key='MY_COSM_KEY'
pa_feed='MY_COSM_FEED_ID'
pa_stream='temp_2'
pfu = PachubeFeedUpdate(pa_feed,pa_key)
pfu.addDatapoint(pa_stream,current_temp)
pfu.buildUpdate()
pfu.sendUpdate()