I managed to build a small python script as proof of concept.
I located the correct address for my sensor data through the Dash on the flukso website. If you are monitoring on minute, the flukso gets its data from the lokal network. In my web browser I retreived the correct link via pagesources(safari) for my flukso:
http://10.0.1.11:8080/sensor/345487e1fa2e73c5d6a166e4190da13a?callback=j...
This link works in a standard web browser, and outputs the last 60 stored values in the flukso.
jQuery17106542406435369124_1359410073538([[1359489910,265],[1359489911,267],[1359489912,267],[1359489913,268],[1359489914,267],[135 ...... 9489965,276],[1359489966,276],[1359489967,276],[1359489968,277],[1359489969,278]]);
I only need the last one. so i wrote the attached script to filter it out. There will be better ways to do it, please feel free to improve it.
- #!
- import urllib2
- import time
- begin_teller = 0
- eind_teller = 0
- three_digit = 0
- var = 1
- while var == 1: # infinite loop
- time.sleep(2) # wait two seconds, don't need the data quicker.
- for line in urllib2.urlopen('http://10.0.1.11:8080/sensor/365487e4fa2e73c5d6a166e4190da13a?callback=jQuery17106542406445369124_1359410073538&version=1.0&interval=minute&resolution=second&unit=watt&_=1359410093774'): # read the data from the flukso
- begin_teller = len(line)-8 #start and end position for the wanted data
- eind_teller = len(line)-4
- three_digit = len(line)-7
- if line[begin_teller:three_digit] == ",": # if the character in this position is a "," then we read 3 digits
- print line[three_digit:eind_teller]
- else: # else read four digits
- print line[begin_teller:eind_teller]
- print "good Night" # end of loop
Hope is is useful, next i will try to get the data using my arduino.
This is how I did it on my arduino.
probably there are better ways also.
Thanks for that, I'll have a tinker!
Michi.
The FLM advertises its enabled sensors to the local network via the Bonjour mDNS protocol. While this info cannot (yet) be used in a browser context, you should be able to pick this up using a scripting language.
Thanks for the link! I've never used Bonjour before. I assume someone has written a Python module to resolve addresses via Bonjour? Anyway, I'm sure I'll find out soon enough :)
Cheers,
Michi.
First hit on Google: pybonjour provides a pure-Python interface to Apple Bonjour and compatible DNS-SD libraries (such as Avahi).
The FLM uses the Avahi implementation of the Bonjour protocol.
I just tried this. Works like a charm :-)
Also found a useful Bonjour browser via the Wikipedia page: http://www.tildesoft.com
That one is for OS X, but there are similar programs for Windows and Linux around too.
Michi.
I've experimented with DNSSD as well. Would be great to auto-detect the available sensors in the LAN and be able to access them in a browser context. That would make the real-time charting more robust. Pity that none of the browsers natively supports a JS API. You can upvote the feature requests on FF and chrome though.