Samsung Smart TV Control With Smartthings/Webcore

John010,

When editing/creating pistons, if you don’t already have them on, turn on:

Show complex IFs

and

Show when true/false actions

First: Update Existing Netflix Switch

  • Update switch triggers to only respond to Physical changes
    • Prevents triggering the switch when updating the status in the timer later on.
  • Add support for turning off the switch by calling DELETE on /ws/apps/Netflix/run.
    • You can now turn off Netflix by turning your switch off.
  • Remove auto-off functionality since the status is now also updated by the timer created later.

Seconds: Create New Piston for Polling Status

  • Create a new piston and name it something like “Netflix Switch Status Checker”.
  • Add a Timer to execute every 30 seconds.
    • This is how often we’ll check for status updates.
  • Make a GET request to http://<TV_IP>:8001/ws/apps/Netflix
  • Add an if expression of $response contains ‘running’ is true
  • When 4 is true, do a sanity check if the switch isn’t on, then turn it on. Otherwise do nothing.
    • No need to run a command when we don’t have to.
  • When 4 is false, do a sanity check if the switch isn’t off, then turn it off. Otherwise do nothing.

FYI, the false case for $response contains ‘running’ can be one of two things:

  1. When the response body doesn’t contain the text ‘running’, e.g. when Netflix is off the status will be ‘stopped’.
  2. The the TV is off, the web request will return an empty response.

Let me know if you have any questions.

Update
I built these when others were using the TV and I couldn’t fully test them. Now that the pistons have run for a bit, there is an error where the polling will cause the TV to turn on when it’s off. Will figure out a fix and update this in a bit.

Hey, thanks for your help.

My piston is exactly like yours. The only thing that I added for test purposes was a “chanelUp();” before the URL call to test.
When I added the chanelUp it worked, but the URL call responded with a 408 response.
To clarify I don´t have a Smarthings hub. Just the Classic app.

Thats looking very good. Thanks for the great tutorial. As soon as i find some time i will implement this.

Sould the same trick be possible with a ´pause´ status? I have a movie mode button, and when thats pressed while the netflix app is running play/pause will adjust the lighting. If i can do something with the netflix status like you did with ‘stopped’ it would mean if i press pause on the actual tv remote it will also adjust the lighting.

Sorry for jumping in on a slghtly different issue (feel free to tell me to start another thread), but you guys seem to know a lot about TV control.

Im using the standard ST App to control my TV and I note that I can set the source on the TV when it powers on along with picture mode and sound mode (also ambient mode). Is this something that wasnt possible when this thread started?

My question is that power on sometimes fails with this message in the Log:-

9:23:19 AM: warn throw : returned java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException: Request timed out to pooch.st.internal/10.1.86.190:80 of 5000 ms

If this happens then the TV doesnt power on although it may work a few mins later.

Do you guys know anything about this TimeoutException?

Thanks

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.