[OBSOLETE] Simple Event Logger

I’m not sure if it’s related, but I saw a post about the latest Android mobile app breaking dynamic pages. Cneck the settings and see if any of the related settings are empty.

I got this working well with the AEON Energy Monitor. I can only seem to get it to log the events “power” and “energy”. Id like to have it log both “Pole 1” and “Pole 2” so I can see the power spikes. Any chance this can be updated?

After seeing this post I checked my logs.
and there is something messed up, not the same issue but its no longer logging, and I have hundreds if not thousands of duplicate Archives!!!

To be honest, mine stopped working when I posted. I was using this and Google sheets logger. I decided to stay with google sheets logger as it formats the info in columns instead of rows and I cannot use a pivot table because my data is to large. Your issue is not what mine was doing. Your screen shot shows there is certainly an issue going on. In my opinion I would just create a new logging sheet and see what happens. You can always copy your data to the new sheet.

What do you have your auto archive settings set to?

When you noticed this problem did you check Live Logging and see if the application was generating error messages?

I had archive set for 5000 events.

I first check all settings, I didn’t see any thing odd.
So I then disabled auto archive, and started delleting the duplicates.
Then i did turn on logging for a few hour’s and there was no errors.
I did notoice that it was trying to catch up (was 5 days behind)

I have sense deleted over a thousand duplicate files and the logger is now all caught up working great agine.
Very cool how it was able to recover 5 days of data😊

I now have the archive setting for “out out space”
I will watch to see if it works.

I only lost 2 weeks of logs back in Jun when the archiveing issue first started.

Thank you!

I recommend keeping the archive settings set to somewhere between 2,500 and 75,000 because at 90,000 events the logging process frequently timed out and I wasn’t able to do anything with the data because the sheet crashed every time I tried to apply a filter.

I think I’m going to add an optional feature that sends an email before archiving that way you’ll immediately know if the process gets stuck.

Thats why i had it set to 50,000.
I thought that maybe the space ran out beforehand and caused the problem.
Or its because i was messing around with it during that time. Think ill do as uou recommended to somone to always make a copy beforehand.

That would be great.
Thank you!

I’m new here, just got a ST hub and a few other things to hook up. I wanted to track my stuff so I installed according to your instructions. For the most part it worked, but I wanted to let you know that you should mention that your need to set the location of your hub on the mobile app for this to work.

Anyways, regarding logging, in the time zone offset I noticed that it’s not working correctly.

private getFormattedLocalTime(utcTime) {
        	if (utcTime) {
		try {
			def localTZ = TimeZone.getTimeZone(location.timeZone.ID)
			def localDate = new Date(utcTime + localTZ.getOffset(utcTime))	
			return localDate.format("MM/dd/yyyy HH:mm:ss")
		}
		catch (e) {
			logWarn "Unable to get formatted local time for ${utcTime}: ${e.message}"
			return "${utcTime}"
		}
	}
	else {
		return ""
	}
}

Specifically “def localTZ = TimeZone.getTimeZone(location.timeZone.ID)”, the ID doesn’t work correctly. I printed out localTZ and this is what I got:

sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]

I really have no idea how to parse it properly and it’s not working for me. For the meantime I’ve jut taken out the offset so I’m logging UTC. For the record, my offset is currently -5 hours.

Any ideas here?

Is there a way to use multiple spreadsheets?

I have quite a few sensors and the data is getting too big to handle (When I use importrange on other spreadsheets, it errors out due to size, and handling the data on the log spreadsheet makes google docs time out).

It could be nice to have 1 sheet per sensor, or extra sheets when the 1st one gets filled (this seems to be on the list of future updates)

That’s on my To Do list, but I’ve found that most users are finding the data hard to work with and end up dropping this SmartApp for the Google logging SmartApp so enhancements to this application are a low priority.

what app is Google logging SmartApp ? Did a search but couldn’t find it

GoogleSheetsLogging (in github its GoogleDocsLogging). Here is the post…

Here is the github

Not me, your app works great and is rock solid. Looking forward to the next update!

2 Likes

I fully agree!

1 Like

Hello,

Im having some trouble(see below for my duck tape fix). I followed the install twice but I keep getting the same error. I read all 215 comments and tried a few things but it didnt work.

my excel file is completely empty (except for the script that displays Version 01.03.00)

Phone app under about simple event logger says: “Google Script: ? (expected version is 01.03.00)”. I double checked my google sheets web app link and I do get “Version 01.03.00” HOWEVER my link is a little weird and I had to change it from https://script.google.com/macros/u/1/s/abcdefg123456789 (notice the extra u/1/) to https://script.google.com/macros/s/abcdefg123456789 to get it to work. tried the recommended action of going into app and forcing it to recheck settings by clicking done until back to main screen of app… didnt change anything…

second problem I found. under smartthings live log I get: " java.lang.SecurityException: Getting properties on class java.lang.NullPointerException is not allowed @ line 742" I changed the code by adding one extra line at 733 and error changed from line 742 to line 743 so atleast I sort of know where the error is.

I commented out line 742 and got DATA!!! YAAA! ok but Im not comfortable with java and is this going to kill my code later?

741 catch (e) {
742 //logWarn "Unable to get formatted local time for ${utcTime}: ${e.message}"
743 return "${utcTime}"
744 }

Is it still showing that message about the version?

It’s always been the same url, but when I have a chance I’ll modify that url related code to make it more flexible.

The original error is usually caused by the time zone not being specified in the location settings. I’ll release a new version that logs the error object instead of trying to get the message from the error which should fix that additional error.

1 Like

I have not found a timezone option in the smartthigns app or on the smartthings website. my Hub shows the correct time viewed in smartthings website. (found a fix see below)

This is what Im getting for a datetime at about 9:49:40 AM or 9:53:53 AM (central time zone) 20/Sep/2017.
1505918980259 Solar Energy Meter power 247 247 W
5 min later
1505919280319 Solar Energy Meter power 235 235 W
Excel and google sheets refuses to format it as any form of date and or time.
assuming its 5 min apart then it looks like it might be in miliseconds.

Ok fixed it! Im going to leave the data so others that noob it up can fix theirs.
I manually set the location in the app by clicking the three bars and then the gear (top right). Click the map and Long press to set a pin manually. Instantly date and time to start working in google sheets.

1 Like

Hi !
This app looks great, but I’m having trouble with the google script. When I publish, following the instructions, I get the error message when I go to view the link (rather than a message starting with a version number):

“Sorry, unable to open the file at this time.
Please check the address and try again.”

I actually got the same message when I tried to do the same with the Google Docs Logging smartapp - so it might be something I’m doing wrong.

I’m pretty sure I’m following the intstructions correctly - any idea what might be wrong?

Thanks!

Tom

Did you set the permissions to the option specified in the instructions? I don’t have it in front of me, but it’s something like “everyone, including anonymous”.