[OBSOLETE] Simple Event Logger

This SmartApp will stop working when the Groovy platform is retired

This SmartApp is no longer supported because SmartThings made some changes to the way events are handled which has impacted some users and it will most likely completely stop working in the near future.

There’s another SmartApp called something like Google Sheets Logger that subscribes to the events instead of retrieving them from the device history so it most likely won’t have the same issues as this one.

Simple Event Logger is a fully customizable SmartApp that allows you to accurately log all device activity to a Google Sheets Spreadsheet. Each event is stored on a separate row so that you have their exact time and details.

Google Sheets has an easy to use filter feature which allows you to do things like view all events for specific device(s), in a specified date/range and/or specific types of events like temperature.

Since all of your data will be stored in one spreadsheet, advanced users can easily generate pivot tables and graphs for any information they need. It also eliminates the need to update the code in multiple spreadsheets every time a new version is released.

See the Installation Instructions for a complete list of features that make this SmartApp unique.

This SmartApp was created entirely from scratch and has no relation to or code from any other logging related SmartApp.


Screenshots


Installation

This SmartApp involves the usual code for the SmartApp and code that needs to be added to a Google Sheet so please follow the installation instructions instead of just grabbing the code below and installing it like any other SmartApp.

Installation Instructions


SmartApp Code

Google Sheets Script Code

41 Likes

Great timing, I’m anxious to give this a go. As tomorrow I’m installing motion sensors in my MIL house to monitor her movement.
I had already created a simple core app to count the motion triggers but this will allow me to look at the data.
So now I can have one data table for her activity and another to monitor my own house.

Thanks in advance. :smile:

Assuming you can see all of her stuff and your stuff in the same SmartThings account, you have a couple of options:

  1. Setup one Google Sheet that monitors everything and create a filter for her stuff and another for yours. The installation instructions has a section on how to create and save filters.

  2. Create 2 Google Sheets and install the SmartApp twice. The “title” field in the SmartApp allows you to change the name so you can tell them apart.

1 Like

Thanks, on my to do list tomorrow. Most likely just set up her house as a second location on my account route.

Installed today without any problem. Have been testing as well and so far it’s flawless for my needs. Another great project by you, I truly appreciate your work. Thanks!

2 Likes

I am getting an error in IDE on line 527 “Cannot invoke toLowerCase() on null object @ line 527”. Did i do something wrong on installation? Looking forward to trying this out! Thanks!

I am getting the same error:

java.lang.NullPointerException: Cannot invoke method toLowerCase() on null object @ line 527

I just released version 1.0.1 which I think will fix that problem, but since I can’t reproduce it you’ll have to let me know.

I only changed the SmartApp so you don’t have to update the script in the Google Sheet.

Thanks. I no longer get the error. I get this in IDE “Found 385 events between 12/27/2016 12:43:53 and 12/28/2016 12:43:52, posting them to Google Web App”, which seems right. However it never post to the Google Sheet.

If you have the sheet open, you may need to re-open it to see the new entries.

You should have seen a second entry in live logging within 30 seconds that confirmed what was logged.

After publishing the Google web app and copying its url, did you log out of Google and test the url to make sure that it displays the version number?

Ah, I don’t see the second entry in IDE that confirms the posting. Yes, I did open the URL after publishing the web app and I believe it said something like Version 1.0.0.

Were you logged out of Google when you tested it?

No but I have closed now. Lets see what happens in a few minutes. Thanks for your help Kevin.

I meant manually test that url while not logged into google…

Just test on another machine that I am not logged into Google on with the URL. Results were: Version 01.00.00

I just wanted to make sure it wasn’t a permissions problem.

If you go into the “Other Settings” section of the SmartApp and enable the live logging option trace, it should log more info to live logging which will help troubleshoot.

Here is what I get now. The 405 is probably not good.

1:21:14 PM: trace Google Sheets Logging Response: 405
1:21:14 PM: debug Found 376 events between 12/27/2016 12:43:53 and 12/28/2016 13:21:06, posting them to Google Web App
1:21:06 PM: trace Retrieving Events from Tue Dec 27 17:43:53 UTC 2016 to Wed Dec 28 18:21:06 UTC 2016

The url shown when publishing the Google sheet gets redirected to another page.

Does the url you pasted into the SmartApp start with https://script.google.com/macros/s/

No it did not. It does now and will let you know the results. Here is what happened, I think, when I copied the URL out of my Google Inbox email that it placed the URL for the inbox rather than the web app URL.

Yup there we go! All is posting now. Thanks again!

1 Like