Ultimate OAuth Endpoint


(Im Brian) #1

I’ve been working on creating a device dashboard that integrates a number of different systems - including SmartThings. I’ve seen a few OAuth endpoints that were pretty good - they’d allow you to toggle a device state - some that’d show you the current state of a device type (show all switches or show all locks, etc).

I thought I’d share my current work in progress. It has the following features:

  • For every action against the API, it returns the entire state of the world. It’ll tell you every device, it’s state as well as current mode.
  • You can toggle lights and locks. You can change mode. I can add other device types if requested (such as thermostats, alarms, etc).
  • When an action occurs on SmartThings - it can send a local IP update to another system. My homebrew automation system runs on my local Intranet. SmartThings can update it after every action so it’s always in sync.
  • If, for whatever reason, systems come out of sync - there’s a /list URL you can poll against to re-establish the state of the world.

If you’re looking for an OAuth endpoint to integrate into another system, I’d love to hear your feedback. Some elements - such as the local IP URL I’m hitting - are specific to my homebrew system, but can easily be edited.