Prerequisites

Install Smartthings CLI

  1. Open Terminal from /Applications/Utilities/Terminal.app

  2. Install Homebrew

    /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
    
  3. Install the SmartThings CLI

    brew install smartthingscommunity/smartthings/smartthings
    
  4. Create an OAuth-In app

    smartthings apps:create
    
     Display Name     TVcontrol
     App Id           42431bd0-bfa2-...
     App Name         atv-f0c8a261-...
     Description      TV
     Single Instance  true
     Classifications  CONNECTED_SERVICE
     App Type         API_ONLY
    
    <https://httpbin.org/get>
     OAuth Client Id      be8e3da9-7977-431b-969e-....
     OAuth Client Secret  2f4bb980-41c5-44ed-ae77-....
    
  5. Initiate the Oauth process from a web browser

    <https://api.smartthings.com/oauth/authorize?client_id=8cfa6928>...(OAuth ClientID)&response_type=code&scope=r:devices:*,x:devices:*&redirect_uri=https://httpbin.org/get&state=xyz
    

    <aside> ⚠️

    If you get an error, try the process again with these additional steps.

    1. Install Docker Desktop - https://www.docker.com/products/docker-desktop/
    2. Add a Docker container - https://hub.docker.com/r/kennethreitz/httpbin
    3. Run the container before trying again Step #5.

    Once you get the 6 digit token, the docker can be safely removed.

    </aside>

  6. Obtain Refresh Token from Terminal

    curl -u "[client id]:[client secret]" <https://api.smartthings.com/oauth/token> -d "grant_type=authorization_code&client_id=[client id]&code=[6digit code]&redirect_uri=https://httpbin.org/get"
    

DATA JAR

  1. Install Data Jar • Download Data Jar from the App Store. (Free download / You can tip the dev)

    Data Jar

  2. Add 4 keys to Data Jar • Open Data Jar. • Tap the “+” to add a new value. • Select text, Add client_id as key, Copy/paste OAuth Client Id. • Repeat to add secret for OAuth Client Secret. • Repeat to add refresh_token for OAuth Client Secret. • Add an empty access_token

    2025-05-25 17.38.25.png

Found this helpful? You can buy me a coffee!

bmc_qr.png

TherapyDoge is making stuff around automating my daily life...