Dev corner

Calling all engineers, tinkerers, hackers and geeks.

opkg update on FLM -> packages not found

Small note to others and for my future reference:
When running "opkg update" on the FLM, opkg attempts to download from:
"http://downloads.openwrt.org/backfire/10.03.1-rc5/atheros/packages/Packages.gz"
But errors on this with "wget: server returned error: HTTP/1.1 404 Not Found"

Solution: change line line src line in /etc/opkg.conf to
"src/gz packages http://downloads.openwrt.org/backfire/10.03.1/atheros/packages"

then run opkg update again.

Realtime data using python

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.

  1. #!
  2. import urllib2
  3. import time
  4.  
  5. begin_teller = 0
  6. eind_teller = 0
  7. three_digit = 0
  8. var = 1
  9.  
  10. while var == 1: # infinite loop
  11.  time.sleep(2) # wait two seconds, don't need the data quicker.
  12.  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
  13.     begin_teller = len(line)-8 #start and end position for the wanted data
  14.     eind_teller = len(line)-4
  15.     three_digit = len(line)-7
  16.     if line[begin_teller:three_digit] == ",": # if the character in this position is a "," then we read 3 digits
  17.       print line[three_digit:eind_teller]
  18.     else: # else read four digits
  19.       print line[begin_teller:eind_teller]
  20.  
  21. print "good Night" # end of loop

Hope is is useful, next i will try to get the data using my arduino.

Pulse tester

Before connecting the flukso to meters with pulse outputs, we use a Pulse Tester (image attached) to test that the meter and reed switch are delivering pulses.

The pulse tester was made from a calculator, and we attach it to the reed switch coming out of the meter. We keep track of the total pulse count on the Pulse Tester's display and compare with before and after meter readings to verify the pulse rate and meter/reed switch functionality.

realtime flukso sensor data to own database

We know we can query the flukso server via the API, but not for real-time data, i.e. the 1 secs readings.

We would like to having all 1 secs readings from all fluksos go to our own DB. Unfortunately, the fluksos are not on the same subnet (the IP of the DB is fixed and can be contacted from the flukso shell, we however cannot contact the fluksos easily from the DB server).
Soo... or we wait for Mosquitto on the Flukso (but how will we contact this MQTT server without having an IP?), or we implement a push strategy, such as:
+ on the flukso, execute "wget -q -O - http://localhost:8080/sensor/my_sensor_id?version=1.0&interval=minute&unit=watt" with cron every so many seconds, and append the new part to a csv like file
+ again with cron (from time to time), post the file with wget to a web interface which stores it in our DB (we could also do with a mysql client, but this probably won't be provided by a default flukso)

I 'm hoping/searching for an easier path (because this one is quirky). Hence, feel free to comment or post suggestions.

Local log-in on device

I was wandering why the confi-screen of the device is not password protected??
If this is possible, please advise.