Created
January 23, 2014 08:40
-
-
Save shurru/8575078 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import xively | |
import datetime | |
import sys | |
import time | |
import xml.etree.ElementTree as etree | |
import numpy | |
XIVELY_API_KEY= "OXrsK9MwFkcLIJvMRlAouni0TBSYPbT2ZU3tuPpP2uqTZfxi" | |
XIVELY_FEED_ID= 146826075 | |
def updata(val): | |
api = xively.XivelyAPIClient(XIVELY_API_KEY) | |
feed = api.feeds.get(XIVELY_FEED_ID) | |
now = datetime.datetime.utcnow() | |
# tmpr=[] | |
# watts=[] | |
# for i in xrange(0,20): | |
# tmpr.append(numpy.random.randint(20,50)) | |
# watts.append(numpy.random.randint(0,5000)) | |
feed.datastreams = [ | |
xively.Datastream(id='tmpr', current_value=val, at=now), | |
xively.Datastream(id='watts', current_value=val, at=now), | |
] | |
feed.update() | |
print"All done" | |
if __name__ == '__updata__': | |
try: | |
args = sys.argv[1:] | |
main(*args) | |
except KeyboardInterrupt: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment