Building a SmartThings Automation

I’ve been digging into the SmartThings Automation platform a bit. Admittedly, I’m fumbling around a bit. 😊

According to the definitions in the documentation, I think I want to build a WebHook automation. As per the documentation, one should consider an “when the end-user configures the Automation to monitor an open/close sensor, the Automation subscribes to open/close sensor events. SmartThings Cloud waits on these open/close sensor events. Anytime an open/close event occurs, it is first noticed by SmartThings Cloud, which then calls back the SmartApp.”

This is pretty much what I would like to do. I’d like to be able to track the batteries that need replaced on my some 200+ devices in my house.

So I’m going through the process to setup an Automation.

Select automations from the side menu.

Then select new.

Now, on the automation setup screen this appears to be relatively familiar for an OAuth-enabled WebHook type integration with some additional meta-data for use in the Human Interface.

I couldn’t find the documentation for what the WebHook interface should be to meet the contract of the interface. According to the documentation, I’m supposed to support taking in a JSON payload. So maybe I should just create a HTTP Post endpoint that takes a single string as a parameter? Wish there was better documentation.

So just to hack around, I created a vanilla ASP.NET Core Web API and deployed it to Azure App service just to see what would happen when I plugged in the target URL and it failed (as expected).

I think I found the documentation that explains the data contracts I need to handle. It looks like you need to handle various lifecycle events. Starting with the first one, “PING”, that I assume is only used when the SmartApp is registered. I’ll updated my WebAPI and post again when I make progress.

Advertisement

One thought on “Building a SmartThings Automation

  1. So many hoops to jump through just to make a webhook call. Did you figure this out? I just want to create an automation in the SmartThings app that makes a webhook call as an action. Ideally, this would all take place inside my local network, but I don’t have a SmartThings hub, so I guess it would have to go through my webhookrelay endpoint.

    Is it just that I need to know what queries to interpret and respond to? Or is there more to it?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s