[UPDATED 3/27/18] GCal Search

Great detective work. Just for data point reference, I have installed GCal for the first time the other day, and it took me probably 2 or 3 tries before it worked…

I just reused my token and ID from my previous install. I think around the first of the year.

I’ve done my best to follow along, but I’m lost on this…

Where would I need to hard code the access token obtained from the OAuth playground? I’ve tried putting it in place of a few calls, but I still can’t get the app past the “google authentication” screen.

There is a slightly better solution than my half a suggestion above, which I have written to @infofiend to suggest.

Go back to an unmodified version of the current code for the GCal Search Smart App on Github.

Change the word embedded to external in the mainPage() function, it only occurs once.

This gets the OAuth Process to work and will take you out of SmartThings to do so.

Change the entire success function to be as follows

   def success() {

    atomicState.accessToken = createAccessToken()

    def message = """
            <p>Your account is now connected to SmartThings!</p>
            <p>Please return to the SmartThings App to finish setup.</p>
   """
    
  displayMessageAsHtml(message)
  }

With regards to the success function only atomicState.accessToken = createAccessToken() is required to be added, but the mod above makes the message more obvious.

This is not something the original authors or maintainers have commented on yet , but I can’t see too many ways it will cause issues.

I can repeatably do this and one or two others have also had success using this method.

I hope this helps.

Gary

1 Like

Thanks, got that to work.

I also had to change a bunch of instances of graph.api to graph-na02-useast1.api seeing as I’m on the other shard.

Hmm, the access token may have expired already.

I can no longer add new event strings to search for…

Just re-tested and using the ‘external’ suggestion in my last post does not seem to suffer from this issue (it could also be a shard thing, but I doubt it).

I saw a similar behaviour when I was manually adding the tokens in the code the first time around.

I suspect (but cant prove) that if you were manually adding code to use the tokens obtained from the OAuth Playground, this had partially been successful and the token you pasted may well have been taken into use by the SmartApp.

I added some code to the GCalSearch App for debugging, I’ll take a look and see if that can be used to invalidate the refreshToken you have.

I’ll edit my post above to suggest going striaght to the simple code fixes without adding tokens manually beforehand, if they get edited in the wrong manner Google’s API and SmartThings get out of sync.

I just got this to work following Garys new code etc, now to try and work out the rest.

Kev,

Can you let us know if you suffer (or not) from any kind of token expiry issues ?

Gary

Hi Gary,

I’m far from being any kind of expert here but I assume you mean if gcal
fails to login but yes I will let you know.

Regards

Kev

This has worked for several days with help from Gary (thanks again Gary) until today …
Issue #1 I wanted to add an additional trigger (had two up and working)…
In the mobile app in set up of new trigger the second space section says “You can’t currently add this” - which the other set ups say the same thing in this section… but have a blue bar (optional) in the new trigger the left side bar is red indicating the section must be completed. Of course I tried it with out completing anyway - but it will not advance through the set up (finish) - red banner warning Please fill out all required fields.

Issue #2 The Ask Alexa was there I am sure I set it up the first go through … it is no longer anywhere an app that I see. Is anyone else using the Ask Alexa integration with this app ?

Thanks All

I have much the same as above, however if I remove the gcal search from the smartthings app on my phone (android) and simply re-install then things will work for about a day.

What device operating system are the people who have the issue that relates to working for a day or so and then stopping if the suggestions above are followed, using on the device they run the SmartThings App on ?

I am on iOS and have no such issues and wonder if there may an Android specifc issue ?

I am Android . kernal version 3.10.61

I tried to delete the app, both in the mobile app and IDE was unsuccessful at that too.

Android, but I can attempt to recreate on iPhone, and see if it helps.

Edit: I can’t uninstall or remove the SmartApp, or my two created devices. On the iPhone and in the IDE, it can still see the name of the calendar that I pulled the event from… Android screen looks like @femwitjava posted above.

Trying to create a new event on the iPhone, it claims there are no calendars available.

Can you copy the modified code out of the SmartApp in the IDE, then remove the Smart App itself.

If I do that in the IDE, the app is then gone from the phone (iPhone).

The add the SmartApp again with the same code you saved earlier.

Might work , might not, perhaps worth a try ?

In the IDE did you try to uninstall from the location, smart apps, area or just the smart app code.

I’ve had to fix corrupt and errant apps by removing child apps, or the main app itself by going through the location.

Specific ones I was able to fix was when I had bad core pistons, and an extra media renderer app. Probably others too.

Thinking out loud, obviously the app knows when the next event is in the future. Could it take that data and create a new event and write it back to the same calendar?

I am currently doing something like this using an android tablet and tasker. The tablet can have fits and miss events.

You could then set another search to trigger off those events that were created. Would be cool if it was all in one neat package.

Question: has anyone actually posted the revised code in a GitHub Repository somewhere or are their still too many issues?

This seems to work on iOS but not Android and being keen to get this to work I am going to get a tablet anyhow to set up action tiles, if I bought an iPad would this work with still keeping the app on my Android phone also (s7)?