Thursday, September 1, 2011

every 15 second mode

aliasing problems (full second resolution timing) coming from motion events turns out to be the limiting factor:

/usr/local/bin/on_event_start:
LAST=$(cat /tmp/last_nsec)
# NS resolution counter:
NOW=$(awk 'NR == 3 { print $3 }' /proc/timer_list)
DELTA_MS=$(( (NOW - LAST) / 1000000 ))
echo $NOW > /tmp/last_nsec
echo $DELTA_MS > /tmp/last_ms_per_wh
/root/wattvision:
POST_DATA1=(as before)
while true ; do
  POST_DATA2="time=$(date -u +%Y-%m-%dT%H:%M:%S)"
  POST_DATA3="ms_per_wh=$(cat /tmp/last_ms_per_wh)"
  POST_DATA="${POST_DATA1}&${POST_DATA2}&${POST_DATA3}"                
    
  wget -q -O - --post-data="${POST_DATA}" http://www.wattvision.com/api
  code=$?                     
  echo $POST_DATA3, return code: $code     
         
  sleep 17
done


Next up - patch motion to allow events to be of a sub-second interval.

No comments:

Post a Comment

#RSFtalks with Edward Snowden

What an intelligent, thoughtful individual. I find it difficult to forgive 44 for failing to pardon this patriot and instead pursuing him ...

Other Popular Posts: