Samsung Smart TV Control With Smartthings/Webcore

There are two URL patterns to start an app on a 2019 Samsung Smart TV. If one pattern doesn’t work for an app, try the other one.

Pattern 1
http://TV_IP:8001/api/v2/applications/APP_ID
e.g. 192.168.1.202:8001/api/v2/applications/MCmYXNxgcu.DisneyPlus

Pattern 2
http://TV_IP:8001/ws/apps/APP_ID or APP_NAME
e.g. 192.168.1.202:8001/ws/apps/Netflix

Your URL should start with http://. I had to remove the http:// from the e.g. lines because new forum users can’t post more than two links.

Prerequisites

In the end, I couldn’t find all the app IDs I wanted (see: Disney+) and wrote a quick application I installed on the TV to have it dump the application IDs. If you need the application, I can post it. You’d need to be comfortable turning on developer mode on your TV and running a web app on it built from the Tizen IDE (you’ve always wanted to be a Tizen developer, right? :slight_smile:).

Some additional quick thoughts before the Meat and Potatoes How-To:

  • In the examples above, DisneyPlus didn’t work in pattern 2 but it worked with pattern 1. You’ll just need to experiment.
  • Some apps work as just the app name (it’s case sensitive), like Netflix, others require the app ID, MCmYXNxgcu.DisneyPlus.
  • A quick way to test (outside of SmartThings and WebCore),
    • Turn on the TV
    • Send this command (replace TV_IP and whichever URL pattern you’re testing) from a terminal on a computer on the same Wi-Fi network as your TV:
      curl -X POST http://TV_IP:8001/ws/apps/Netflix
      curl -X POST http://TV_IP:8001/api/v2/applications/Netflix
    • Netflix should open. If it does, now you know which url will work for Netflix and can be used inside WebCore. If either URL doesn’t trigger the app to open then your TV may not support these two patterns.

How-To Part 1!

Create virtual switch device

  1. You need virtual switches to toggle your apps ON. Go download the Samsung SmartApp named “Virtual Device Creator”. It’s in the More tab of the SmartApps download area in the SmartThings Classic app. If you can find it in the new app, it may also work in there. I used the classic app to set these up.
  2. Open Virtual Device Creator and create a new switch. My account has issues so I couldn’t use a momentary switch. If you can use that, then your setup can omit later steps where we switch off our switch once we execute a command.
  3. Name the switch “Netflix” and save.
  4. Go to the WebCore SmartApp and add the new virtual switch as a device that can be used by WebCore.

Create WebCore piston

  1. Create a new piston from the web dashboard on a desktop browser (so much easier to read than mobile).
  2. Name it “Netflix”
  3. In the settings (gear icon) for the piston, turn on “disable command optimizations” .
  4. In the If condition, choose your new switch named Netflix.
  5. Create the piston logic like so
  6. Note that if you created a momentary switch instead of a toggle switch (back in step 2 of virtual device creation), then you can omit the last five lines in the piston to turn off the switch again.
  7. Save the piston.
    *Note that there is a command on line 23 to turn the TV on. This is mandatory. It has to be on to switch apps :wink: .

At this point stop and test. With the TV off, go hit the Netflix button in SmartThings. If it turns on, then you can end here and go create more.

…more in next post…

3 Likes