MiCasa Verde (MiOS) DataMine Logging
For my home automation goals, I chose MiCasaVerde VeraLite due to my friend’s recommendation. The VeraLite is a small linux controller that runs the MIDIbox Operating System MiOS and gives a homeowner the ability to easily control lights, security cameras, door locks, alarm systems, and even the thermostat, among many other home systems. For example, you could set your temperature from your mobile device or web browser. I chose this device because of my friend’s experience and the Vera’s compatibly with INSTEON, Z-Wave, and X10 devices and I had previously made a big investment in X10.
Setup was easy and everything worked well with my 2gig CT100 Z-Wave Programmable Thermostat after I completed my initial pairing.
I was happy to see the dataMine Graphing and Logging plugin for my micasaverde veralite, but after mounting my usb, I still couldn’t see any channels.
First thing was to get SSH access to my account so I could do some troubleshooting. To do that, I had to go to account, tech support and enable remote access. If you do that, you get a message like this:
Tech support full control enabled, access code 34014212-123456 (SSH: SSH_22=27032 TS_SRV=ts2)
And your password is 123456 for the user “remote”. In order to get the root password you need to run:
nvram show | grep pass
You’ll see something like this:
vera_wifipass=shade83forest
So in this case, shade83forest, is the actual root password.1
In my ssh shell, I was able to see that my mount was correct and available:
/dev/sda1 506.2M 16.5M 464.0M 3{aaa01f1184b23bc5204459599a780c2efd1a71f819cd2b338cab4b7a2f8e97d4} /dataMine
Through using the file command I could tell this was an ext3 partition:
/dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery) (large files)
I also could get any details on my MiOS version:
Linux MiOS_35017272 2.6.37.1 #2 Fri Feb 22 04:07:32 PST 2013 mips GNU/Linux
After installing, your /dataMine/ directory should be mounted and have the following files:
/dataMine# ls -l -rw-r--r-- 1 root root 252 Jan 26 07:38 InternetOk.log -rw-r--r-- 1 root root 27646 Jan 26 07:48 LuaUPnP.log -rw-r--r-- 1 root root 0 Jan 26 07:38 NetworkMonitor.log -rw-r--r-- 1 root root 2112 Jan 29 06:37 Notifications [R2299].txt -rw-r--r-- 1 root root 468 Feb 1 06:20 Notifications [R2300].txt -rw-r--r-- 1 root root 150 Feb 1 06:20 dataMineConfig.json drwxr-xr-x 2 root root 4096 Jan 26 07:55 database drwx------ 2 root root 16384 Jan 26 07:37 lost+found -rw-r--r-- 1 root root 26 Jan 26 07:38 mount_tests -rw-r--r-- 1 root root 2110 Jan 26 07:38 serproxy.log -rw-r--r-- 1 root root 0 Jan 26 07:48 signal.flag.log -rw-r--r-- 1 root root 50 Jan 26 07:48 signal.log -rw-r--r-- 1 root root 414 Feb 1 07:15 sunriseSunset.txt
If I request debugging information (via /port_3480/data_request?id=lr_dmCtrl&control=debug), I get:
First I found the variable I wanted (current temperature) and enabled logging:
Initially, you don’t get good feedback. I thought I was getting an error and couldn’t get to any logs (see the red exclamation mark where the results should be)
But that should change once events occur and the logging starts.
My debug file has provided the following information:
{"Version":"0.980","dbVersion":2,"Events":{"count":17,"last":1391253610},"guiConfig":[],"Variables":[{"Service":"urn:upnp-org:serviceId:TemperatureSensor1","LastRec":0,"FilterMaximum":0,"Type":0,"Logging":1,"FilterEnable":0,"Device":4,"FilterMinimum":0,"Id":1,"DrowsyWarning":0,"DrowsyError":0,"DataOffset":0,"Name":"CurrentTemp","LastVal":0,"FirstRec":0,"Variable":"CurrentTemperature","DataType":1}],"Graphs":[],"LastWrite":1391261432,"nextId":2}
One problem was that I was getting lots of errors like:
50 02/01/14 12:08:54.833 luup_log:11: dataMine: 1:Unable to open file for read - /dataMine/database/4/raw/2300.txt <0x2d6fa680>
I fixed this this through a little shell script:
cd /dataMine mkdir database cd database for x in 1 2 3 4 5 6 7 8 9 do mkdir $x mkdir $x/raw for y in 0 1 2 3 4 5 6 7 8 9 do mkdir $x$y mkdir $x$y/raw done done
Here are some initial questions I had:
- How do I change update frequency? (Answer: You don’t, you record on state changes.)
- How can I export? (Answer: You ssh to the data directories, and pull out the raw data.)
- How can I match the scales of two different variables? (This one I don’t know.)
It seems all the data are stored in this structure:
root@MiOS_35017272:/dataMine/database# find . -iname "*.txt" ./4/raw/2300.txt ./1/raw/2300.txt ./3/raw/2300.txt
Pretty basic, even though the data are very straightforward (unix time stamp and value):
root@MiOS_35017272:/dataMine/database# more ./3/raw/2300.txt 1391275155,64
Now, I can make these plots:
This is direct from the dataMine app, which has really great browsing capability, but I can’t get the axes to match.
Here is a much better plot with a common axis and appropriate scaling. It is interesting how slowly my house cooled. I need to compare this with local temperatures.
Any thoughts appreciated in the comments.
Resources
- The Big PDF (direct download)
- good link: micasaverde forum
Read with interest yr article about dataMine and followed yr guidance. I’m up and running and wish to take it to the next level, i.e. Mathlab. Could you share with me which file you used to feed Mathlab and whether you had to manipulate the file to make it compatible. Appreciate some guidance.
Rgds
Dick Wismeijer
I’ll try to get something up soon.
Just a note: you can match the axis if you put them on the same axis. Save Graph –>Axis. I am graphing setpoint and current temperature on the same graph, with the same axes.