How to log a specific variable?

Hi guys (and girls, maybe?)
I’ve made big progresses with using my Veralite box (UI5) but now I’m stuck and need a little help:
the whole point of buying Vera was:

  • to manage some usefull devices (heaters at most) - DONE
  • to survey their activity in an appropriate manner, so that I could use the data later for graphs (on my private php server, with the help of php plugins)
    The second point is causing me headachs:
    I NEED to log my data IN A TEXT FILE (csv or json or bson format, whatever) this way, in order to be combined with other sources (Arduino logs for instance): time - variable - status
    For instance:
    18112014 21:17 boiler ON
    18112014 21:30 boiler OFF
    18112014 22:30 fire_alarme TRIGGERED

But I can’t figure out where to do it (should it be added in scenes or in the startup file or as a pluging, or directly adressed from my php server through http requests) and how to do it (should i interrogate the main vera log or create my own or making my own code with io.open() and io.write() functions)?

Your help would be deeply appreciated!
Chris (french, sorry for my bad english)

There are a number of possible plugins that you could use to help accomplish this task, so that most of the hard work has already been done for you.

EventWatcher [url=http://forum.micasaverde.com/index.php/topic,16984.0.html]http://forum.micasaverde.com/index.php/topic,16984.0.html[/url]
is able to record changes in any variable and send them to a variety of destinations including:

[ul][li]a text file,[/li]
[li]a syslog server,[/li]
[li]its own internal cache which can then be plotted.[/li][/ul]

DataMine (no longer under active development) [url=http://forum.micasaverde.com/index.php/board,43.0.html]http://forum.micasaverde.com/index.php/board,43.0.html[/url]

[ul][li]has its own internal database structure which can be written to a USB or NAS[/li]
[li]can plot these data[/li]
[li]with an additional module can be queried to extract ascii data[/li][/ul]

DataYours [url=http://forum.micasaverde.com/index.php/topic,25800.0.html]http://forum.micasaverde.com/index.php/topic,25800.0.html[/url]

[ul][li]currently under development, it includes some functions of both the above plugins[/li]
[li]is very modular and can perhaps give you what you want with a very small footprint on the Vera[/li][/ul]

There are no doubt others you may want to investigate too. Trawling the Vera logs for variable changes is not a direction you should plan on going. You could start from scratch and use a Luup function [url=http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_watch]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_watch[/url] to watch for changes in device variables, but this gets quite hard fairly quickly.

Very helpfull answer.
I’ve already tried EventWatcher. Very very handy tool. But. I need more flexibility :
I’ll log some events on changes, like: light is on/light is off
I’ll log other events every 10 minutes (like energy meters)
I’ll log a few ones once a day or less (like battery levels)
And for some reasons some variables don’t appear whatever the Watchcategories I choose (among them, the KWH variable of my EON switch DSC18, very frustrating!)

The log file will be the link between my home (Veralite, RF sensors, Arduino…) and my computer. Everything is kept in it, and will be accessed by php routines. But a very good option would be to choose what events/variables… you want to watch, like a formular with checkboxes.
I’ll give a try tonight at DataYours…

By the way, let me share my experience:
Access, locally and remotely, through a web browser, to a file stored on VeraLite.
Goal is: my log file (log.txt) will be accessed manually or by php routines this way:
http://ipvera/logfile.txt

EventWatcher documentation is quite complete, but Microsoft is a pain when it comes to access drives on Unix/Linux OS (such as Vera).

[1/ Mount a USB dongle. Internal files on Veralite seems pretty hidden] ? In fact, the ?www? folder is present in the Vera memory, so no need for USB drive!
1/ Use Winscp. No big mystery here: Look for this tool, download it and use it (I recommend the portable version, no need for installation): you can use the .exe file, but I suggest trying the .com file: open a command window then look for the right folder by typing cd or dir… and finally type the following command:
winscp scp:xxx.xxx.xxx.xxx:22 (xxx… is your vera ip, 22 is the standard ssh port)
If I just talked chinese, use the easier way, just double-click the winscp.com file. You’ll get the winscp prompt in a black old-fashioned-dos/like-window:
winscp>
Just type :
open xxx.xxx.xxx.xxx:22 (xxx… is your vera ip, 22 is the standard ssh port)

2/ In both cases, you’ll be prompted for username/password. Don’t use yours, they’re worthless. You need to log as root (so username:root), the default administrator. Password should you find here:
Go to your vera interface. Click the Setup tab, then the Backup tab. The existing backups, highlighted in blue, are our goal: download one of them. It?s a compressed tgz file, you can open it with an archive manager such as PeaZip or Winrar. Among the files in the archive, the first one called cmh.conf holds our password. Open it with a text editor (Notepad, Textpad?) and look for the Password=? That?s it!

3/ Let?s go back to Winscp. Type the password. You?re in!
Let?s wander purposelessly for a few minutes: you just need the ?dir? command to list file/folders in the current folder, and ?cd? command to change direction, ie: ?cd …? to go back and ?cd folder_name? to get into the folder_name folder. If you find a cosy place, note it. For us, it will be the ?www? folder in the root folder (to find it when you?ve typed your password: ?cd …? then ?cd www?).
That?s where we will store our log files, and we will access them through the expected hyperlink:
http://verap_ip/yourfile (the ?www? folder is indeed the root folder from a http browser perspective)

4/ If you?re using EventWatcher, look for the configuration window, and in the Advanced tab, we will populate the LogDirectory variable with: /www/
From now on, the log generated by EventWatcher is directly viewable and usable!

YEEEES!!!
Sorry if all of this was too obvious for some of you, but it took me a few days to figure it out, hope it will help others?

Better being bored than being lost!