Daily Event Log Export - Feature Request

(Gils) #1

I have a feature request for consideration in future releases.

I would very much appreciate the ability to export (receive by email) a log in say .csv format of the SmartThing events that took place for my environment on that day (or for the last 24 hours).

Off the top of my head a file format of something like the following;

	Date				Time			Sensor 						Action			State

e.g. 05/23/2013 1434 Motion Sensor 1 Detected Motion
05/23/2013 1436 Motion Sensor 1 Detected Motion has stopped
05/23/2013 1532 Activity Sensor1 was Active
05/23/2013 1539 Activity Sensor1 was Inactive
05/23/2013 1732 Activity Sensor1 was 72F

Such a log that interested users/builders could export would be of great value in verifying and documenting events that take place in a space supported by SmartThings.

I think a number of us in the SmartThings community would find this functionality valuable. If other forum users agree this would be a desirable feature in future releases, please voice your support.


(Formix) #2

.csv would be nice, that way we could graph functions over time (temp, energy usage, etc.)

(Chuckles) #3

Date and time should be either UTC or, best of all, based on a locale we specify (to account for local timezone offsets, daylight savings, etc.). Please don’t send us a log with info based on some US timezone - trying to deal with changing daylight savings offsets at different times of the year (yours, then ours) would be a headache.

(Eric Schuld) #4

I’d love some sort of reporting - would be nice to have options to setup some custom reports…

That said - have you watched the logs over at graph.api.smartthings.com for your system? I only have 18 items reporting to my system right now - but there is still a lot going on. If you were to get a full day of logs that will be a LOT of content… I’m not sure how long SmartThings keeps logs recorded - or if they do at all for that matter…

Might be a better idea to try and get a group to program a third party app that would simply connect into graph.api and pull the log feeds - something you can keep running on your computer - then you compile the data in reports that you want to see… I have absolutely no skill in this area whatsoever - but I’m sure there is someone who can! :slight_smile:

(Dan Lieberman) #5

I’ll definitely add this to the list of community feature requests - though with a little bit of work you can do some of this today. See this thread for more detail: http://build.smartthings.com/forums/topic/capture-events-to-computer-or-log/

(Hfb) #6

I have a Python script I’ve written that grabs whatever data I want and posts it to ThingSpeak. It could easily be modified to create a CSV file. I have it running via crontab every 10 minutes so I have a nice log of the temperature in various parts of my house.

(Dan Lieberman) #7

@healthyfatboy – Building on that, here’s a simple example of sending data directly from a SmartApp to ThingSpeak without needing an intermediary:

 *  ThingSpeak Temperature Logger
 *  Author: Dan Lieberman
 *  Date: 2013-06-28

preferences {
	section("Log the temperature from this temperature sensor...") {
		input "temp1", "capability.temperatureMeasurement", title: "Where?"
        section( "Enter your ThingSpeak API Key..." ) {
		input "thingSpeakApiKey", "text"

def installed() {
	log.debug "Installed with settings: ${settings}"

def updated() {
	log.debug "Updated with settings: ${settings}"

def initialize() {
	subscribe( temp1, "temperature", handleTemperatureEvent );

def handleTemperatureEvent( evt ) {
	def httpGetUrl = "http://api.thingspeak.com/update?key=${thingSpeakApiKey}&field1=${evt.value}"
        httpGet( httpGetUrl ) { response -> 
    	if ( response.status != 200 ) {
        	log.debug( "ThingSpeak Logging Failed: status was ${response.status}" )
        } else {
        	log.debug( "ThingSpeak Logging Successful" )

This only sends one value to ThingSpeak, but this could be easily modified to send multiple values to a single channel.

(Hfb) #8

Okay, it’s been a long time but I finally got around to doing this and did it for 8 sensors. I have to say while it’s much more instantaneous compared to having my Raspberry Pi go through each page to strip the temperature data from each sensor, the resolution is terrible, there is STILL a temperature offset on these multi’s that I have found to be incredibly annoying, granted I can take care of that in Python using my Pi, and at least with how it’s set, it only plots a point after a change. If I could plot a point every 5 minutes, then it would be a little more useful and in my mind, would look better. However, even then, 1 degree F resolution on temperature for units that don’t change much more than +/- 5 F in a typical house is a bit lame to me.
Thanks for the code Dan. It helped get things rolling and I’m glad I finally got around to it after a year!


New UK user and first post on the forum.

I was really hoping that it would be possible to export activity data as a csv file, as a standard feature of the software, for analysis. Now that v2 has been released, is there a clear indication from ST that this will be coming?

I’m not really into coding/scripts, so I’m hoping that this will be as simple as emailing a csv file on demand or automatically.

Thanks in advance for any comments.