Log to Google Sheets

I seek a solution to log the ST history to a Google sheet.

Older threads on topic are outdated as the ST architecture has changed.

Is any approach feasible that pipes or exports what is visible under History on the ST app into a Google sheet or similar?

Maybe check out this thread.

Post-groovy Google Sheets Integration

Thanks! Would anything on the cloud / less involved be available? (ie not running a local machine 24/7 at home)

1 Like

Well, cloud service is possible, but I don’t think there is an out of the box solution. So you should expect to do some work to get it working.

Try looking into Google Apps Script. It is a web platform based on Javascript for Google Workspace apps automations, such as Sheets and Docs. It is a great and powerful solution to automate and add data to google sheets, and everything happens in the cloud.

Using Google Apps Script, you can interact with Smartthings API (by using url fetch methods available in Google apps script) to get status of your devices, then you can log them in Sheets. All in single script + all in cloud. But again, it all depends on what is your specific needs and how basic or complex you want it to be.

Keep in mind that you can only get device status for Smartthings either manually or by automating your script to run certain times during the day (time based triggers). However, If you want a real-time status update, i.e. if you open the door, immediately log it in Sheets, you definitely need a local machine to let your Google Apps Script know that a change happened in device status.

Thank you. I’m aware and should be somewhat able to use Apps Script in sheets. I seek to find the best logic or command in the ST API, however.

I don’t require a real time update or push notification upon some ST activity. Pulling the history out of ST, eg all logs since the last pull, let’s say at an hourly interval, that would be fine.

However, I can’t seem to identify the right call within the ST API, any pointers appreciated.

This is a really helpful thread:

So basically, you can get component attributes (or status) of all your devices in a single API call using:

GET https://api.smartthings.com/devices?capabilitiesMode=and&includeStatus=true

In call Headers, along with Authorization token, you need to include Accept header with value of application/vnd.smartthings+json;v=20170916

The response is JSON which you can parse. Hope this will help.