Writing code to log all sensors to a logfile (csv)


I’ve bought a Vera 3 recently and like to log my temperature sensors to a text file in the csv format, so I can read them periodically from a remote location.

How do I start programming the vera3?

I have programming experience.


Some search terms that’ll help you to find the past discussions:

luup.variable_watch(): This function registers a callback that Vera calls when a requested variable changes.

dataMine: an extensive logging tool that will track any variable you ask for, now EOL’d.

dataYours: the nascent followup to dataMine, perhaps more suited to your needs because of its modularity.

Also off-forum, the Lua Manual and the Micasaverde Wiki.

You could also use EventWatcher. This can log selected variables - including temperature - to a csv file.

I?m also intereseted on exporting the electric measures of the z-wave devices into a csv file but in ERGY plus is a premium feature (and costs money) and in Data Mine Graphing and Logging I don?t find the way to the power consumption into a CSV file.

Thank you for your help!

Any of the proposed solutions should work. You can also use dmDBserver or DataYours to extract CSV from dataMine.

One thing you should be aware of in seeking to process power data is that Vera data is generally only written when it changes. For a (whole house) power meter, this is not really an issue, since consumption is varying all the time. For single on/off devices, you will only get a report when they are switched on or off. In other words, you need to integrate the measurements you get, or arrange a different collection method (polling, for example.)

None of this is insurmountable, but just to point out that it is not trivial even once you have the data. For this reason, I’m planning to put a polling front-end option into [tt]DataYours[/tt] for power monitoring (and door sensors.)