[RELEASE] Simple Event Logger

Either that or you copied it from the page you were taken to when you tested the url.

The next version will verify the url and display a warning if it doesn’t start right and it will also display a warning if Google returns an unexpected message, like 405.

Do you think it would be easier for users if they had to enter just the web app id portion of the url instead of the whole thing?

My vote is for URL.

Thanks again for this and I have sent over a paypal donation. Great work!

Another thought. I see in IDE that it logs the amount of space available in the sheet. Would it be possible in the next version, to get a warning at a certain threshold so that I know that I have to archive or purge events?

I admit, I selected a lot of stuff which might be the culprint, but check out the errors I am getting:

3:50:14 PM: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 87341790546321 @ line 542
3:49:54 PM: trace Retrieving Events from Tue Dec 27 20:34:55 UTC 2016 to Wed Dec 28 20:49:54 UTC 2016
3:45:14 PM: trace Google Sheets Logging Response: 405

I don’t see anything in my Google Sheets.

Please verify that your web app url field starts with: https://script.google.com/macros/s/

I’m monitoring about 65 devices and I see I usually see a timeout error every couple of hours. The next time it runs it will include the events that previously failed to upload. I have some ideas on how I can avoid them, but I figured I’d wait to see if anyone actually uses it before I spend time on those types of things.

Yes I plan on adding that, but as far as I know, there’s no way to get the actual amount of free space in a spreadsheet. My SmartApp calculates it using the last column and row numbers and the max number of cells allowed in a spreadsheet.

if you create additional sheets within the spreadsheet for pivot tables or charts that might effect the free space, but I haven’t tested it.

I’m also considering adding a couple more web app url fields so you can optionally have multiple sheets. When the first one becomes full, it starts logging in the second, and then the 3rd(if applicable). Once it runs out of spreadsheets it can either stop logging or go back to the first book, clear it and start the cycle over.

The future features section of the documentation has some additional features I’m considering.

@krlaframboise Genius. That is pretty slick. Can you point to the sheet in Google docs from another sheet as a data set for pivot tables and charts? Have not played around with Google Docs all that much but will be using it more now, really just got a random thought in my head!

EDIT: Re: Goggle Sheets - Wow the built-in simple analytics are pretty cool. I was playing with a few questions and it seemed to respond correctly, they were simple questions. The I asked this “pie chart of Event Name switch and Event Value is on”. Response was “Answers provides formulas based on your data. Charts are currently not supported. Please use the menus to create a chart.”. Still I have to say it is really neat.

1 Like

Hmmm mine starts with:

https://script.googleusercontent.com/macros/echo?user_content_key=

1 Like

Same issue I had. Find the url again and copy and then paste directly into the smart app. Must be something on the google side that causes this.

If you go back and get the url from the script editor publish page you should be all set, but let me know if you continue having problems.

The documentation says to test the url, but when you test the url it actually takes you to a different page so if you later copy the url from that page, it’s not going to work.

I’ll update the documentation tonight to make sure users are aware of which url that have to use.

I thought I’d be making it easier for everyone by having them paste the entire url instead of just the end of the url which is the only part I need. Because of the redirect issue, I’m starting to think I might be better off requesting just the ID.

What do you think?

Thank you for being patient while I worked the bugs out and for the generous donation.

I’m writing a DTH for the Dome Siren this weekend and you just paid a good portion of the device. :grin:

I’m new and having trouble. I create the google sheet no issue. Create the code in my apps. My issue is its not showing up in my mobile app to install. under market place smart apps I don’t find “my apps” at all. I walk the process a couple time now. What did I miss. Again I’m new and not sure where I went wrong. Thanks for the help

Check out the page below and then let me know if you’re still having problems.

http://thingsthataresmart.wiki/index.php?title=Using_Custom_Code#Using_A_Custom_SmartApp

Kevin
Thank you for the quick response. I did read that and followed it but just logged out of all device and site logged back into site and went to review my apps and your apps is now not there. Its late for me now I will try again tomorrow. I will report back my finding. Again thanks for getting back to me so quickly. Also found that is did not show as installed app under location in the APi. tomorrows another day.:grin:

If you change the settings “Log Events Every” to 5 minutes and “Maximum Number of Events” to 5, you may reduce the timeout errors you’re experiencing.

These are basically the steps that need to be followed on the SmartThings side of things.

  1. Log into the IDE
  2. Click on My SmartApps
  3. If the Simple Event Logger is shown on that page click it and skip to #4, otherwise perform the steps below:
    a. Click New SmartApps
    b. Click the “From Code” tab
    c. Copy the SmartApp code and paste it into this window.
    d. Click Create
  4. Both of those options should have brought you to a page that shows that SmartApps code and has buttons for “Publish” and “App Settings”.
  5. Click App Setting
  6. Click OAuth and then Click “Enable OAuth” in SmartApp.
  7. Click the “Update” button.
  8. Click the “Code” button which is located on the right side of the page near the top.
  9. Click Save
  10. Click Publish
  11. Go into the SmartThings mobile app

If those are the steps you performed the first time, then it could be the device you’re using.

My Android phone and Android tablet have the same SmartThings mobile app version and build installed, but my tablet doesn’t show the “My Apps” links.

I just use my phone when I need to install something, but if you don’t have another device to try and you’ve performed all the steps above, I recommend contacting SmartThings support.

I got it working. I made the same mistake as @pmusselman. We are all humans after all. I also took your advice and lowered the events to 5. Will I be missing any data by doing this?

1 Like

That mistake is really easy to make because of the way the url redirects so I’ve updated the documentation to point that problem out.

In version 1.0.2, which I released last night, I added a label below that field that shows what the url should start with. I also made it check the url when you tap Done and if it starts with a url it writes a warning to Live Logging and doesn’t attempt to run. It will also write a warning to Live Logging if the url looks like, but doesn’t work.

Yes, there is a risk of data lost because if more than 5 events occurred within 5 minutes, they will get lost. The SmartApp only logs events that were generated by the device so if there are other events like the platform polling a device, they will be counted towards those 5 even though they don’t get logged.

I just counted the number of devices mine is logging and I was mistaken. I’m only logging events for 47 devices, but I have the maximum event setting set to 50 and I only see the occasional time out.

I know this isn’t ideal, but you could split your device list in half and run 2 instances of the SmartApp that are able to log a lot more events. You might be able to have both instances point at the same Google Sheet, but I haven’t tested it so I’m not sure what happens if they both send events to be logged at the same time.

My Dome Siren came in this morning so once I’ve finished writing that DTH, I’ll start working on a workaround for that timeout error.

Just wanted to say I just set this up. Taking my time and reading the directions it didn’t take maybe 20 minutes tops. It is logging my events to the sheet as it should the first time through.

The only hiccup I had was the first step of setting the smart app up it kept crashing. Possibly I wasn’t waiting long enough for it to load my devices. I would get the first few devices and then it would crash. I eventually just picked a few and let it finish setting up the app.

I’ll go back later and select more devices and options as I learn to gather the data I want to be stored.

I would like to cast my vote for a parent / child setup. Even if it is separate for people who can handle keeping straight what each child app is doing in the setup. I personally think it would be less cluttered to log each type of data in it’s own sheet and then manipulated the data in that sheet when I open them separately.

My opinion on that might change as I get used to it and get my filters and such set up.

Now it’s time to learn how to manipulate google docs sheet to get things to chart / display how I want when I open it.

I would like to say THANK YOU for making this. It was VERY EASY to setup and get going. Great work and very helpful for those of us who would like to track data / trends and such but don’t know how to code.

I’m off to learn more and see what this app can do!

2 Likes

@krlaframboise quick question before I dig into the google docs stuff.

Can I create charts and line graphs on additional sheets in the same google spreadsheet? Or should I look at keeping them separate to save space for data in the spreadsheet? Just curious?