Xively extract current datastream value
I'm able to extract the latest value of the datastream using the following
code BUT the problem is that if I change the value or update the value at
the Xively dashboard console then the code isn't able to capture the
change but still remains displaying the old value!
# main program entry point - runs continuously updating our datastream
with the
def run():
print "Starting Xively tutorial script"
feed = api.feeds.get(FEED_ID)
datastream = get_datastream(feed)
datastream.max_value = None
datastream.min_value = None
while True:
if DEBUG:
print "Updating Xively feed with value: %s"
datastream.at = datetime.datetime.utcnow()
datastream.update()
check_point = datastream.current_value
print "AAGYa: %s" % check_point
if check_point == '50':
outPin = file("/sys/class/gpio/gpio44/value", "w")
outPin.write("1")
elif check_point == '':
outPin = file("/sys/class/gpio/gpio44/value", "w")
outPin.write("1")
elif check_point == '':
outPin = file("/sys/class/gpio/gpio44/value", "w")
outPin.write("1")
run()
THE code is in PYTHON
No comments:
Post a Comment