SmartThings Community

[RELEASE] Simple Event Logger

smartapp_misc
logging
google

(Kevin) #1

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


Google Sheets Charts
ROUNDUP: Data Logging and Charting Solutions
Aeon Home Energy Meter - daily usage and cost summary
Dweet Dashboard
FortrezZ Water Flow Meter
Info shown on Dashboard
Aeotec home energy meter V1(DSB09104-ZWUS) log to spread sheet
How to monitor/log energy usage? Daily/month numbers Aeon Labs Aeotec Z-Wave Smart Switch 6, Gen5
Get value from temperature sensor and store it in a database
How long are logs kept for sensors?
Any compatible smart power outlets that do historical energy monitoring?
How to monitor/log energy usage? Daily/month numbers Aeon Labs Aeotec Z-Wave Smart Switch 6, Gen5
Energy monitoring?
Consuming smartapp from C# desktop application
Is anyone putting multisensors in every room, and gathering/using mean data from it all?
Any way to track and record temperature readings?
How To Log Temperature Changes To Google Sheets Using Web Request
Zooz ZSE40 4-1 Motion Sensor and other Zooz devices (ZSE01, ZSE02)
Smart Lock History lost
ROUNDUP: Data Logging and Charting Solutions
Nest Thermostat Graphing and Data Collection
[RELEASE] Resilient - My Ecobee Device & ecosystem v5 - The smartest thermostat under ST with new "comfort tips" features and Unique Integration with Echo/Ask Alexa
Informative apps for Aeon Labs Enegry sensor?
Aeon HEM v1 DH (updated 06-14-2017) Discussion (DTH link in post 329)
Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)
Kind of a nerd thing but..... ST Data Dump?
Lowes iris 2nd generation smart plug
Aeotec Home Energy Meter Gen 5 composite DTH
Batteries die in freezer using Multipurpose Sensor
Something to log device data at specific time(s) each day?
Intermatic PE653 Pool Control System
(Don) #2

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:


(Kevin) #3

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.


(Don) #4

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


(Matt) #5

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!


(Patrick Musselman) #6

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!


(Marc) #7

I am getting the same error:

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


(Kevin) #8

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.


(Patrick Musselman) #9

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.


(Kevin) #10

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?


(Patrick Musselman) #11

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.


(Kevin) #12

Were you logged out of Google when you tested it?


(Patrick Musselman) #13

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


(Kevin) #14

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


(Patrick Musselman) #15

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


(Kevin) #16

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.


(Patrick Musselman) #17

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


(Kevin) #18

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/


(Patrick Musselman) #19

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.


(Patrick Musselman) #20

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