Nividia shield tv with CEC Tasker

How I run Apps Via Tasker to my Shield TV. (Assumes you know how to sideload apps, and know the basics of Tasker) Some of these I had to go to my Playstore account and download them to the Shield this way because I didn’t find them in a search (actually almost all of them LOL). (BTW I wrote this on my lunch break so im sorry about any mistake)

First of all I have CEC on my TV which makes this process significantly easier (Its the closest thing to having a SMART tv IMHO). The only thing I actually use CEC for is turning the TV on and off with Shield On and Sleep. Instead of having a “Power” button like most have which toggles on and off I have a On event and an Off event.

Enable debugging

  1. Goto Settings
  2. Go across to About in Device
  3. Go down to Build and click on it 10times until it says you are in development mode

ADB over USB

  1. Make sure you have performed the above steps “Enable debugging”
  2. Goto Settings
  3. Go Across to Developer options
  4. Go down to Debugging
  5. Toggle USB debugging to On

ADB over Network

  1. Make sure you have performed the above steps “Enable debugging”
  2. Make sure you have performed the above steps “ADB over USB”
  3. Toggle Network debugging to On

Youtube tutorial done on my phone lol

Apps needed on Shield. (Tasker, Autoapps, Autoinput, Secure Settings, AutoRemote, AutoWeb, ADB Shell [Tasker] ) A MOUSE AND KEYBOARD ARE ALSO NEEDED TRUST ME
For most of these to work you need to set up Autoremote properly.

  • Download Autoremote and Tasker

  • So to settings, accessibility settings, and turn it on for tasker

  • Open Autoremote app and it will prompt you to name your device, I had to do it a couple times for it to stick.

  • GO to the preferences and make sure that it is active,

  • Open tasker and go to profiles and create a new event. SYSTEM, DEVICE BOOT. (no options needed)

  • New task will open up and create a new task, (I called mine WIFI), Add action, search for “AutoRemote Wifi”. Go into the configuration, check Wifi Service, Check persistence notification, back out twice and execute the action by pressing the play button on the bottom left hand corner.

  •  You can now send messages Locally in your network
    

“On” Command

  • Download “Secure Settings” from play store
  • Open tasker and go to profiles. Create new profile, Event, search for autoremote, go into configuration, Click on message filter.
  • Enter something simple, mine is “tv_on” (without quotes) then press ok, click on “case insensitive”, press back button twice.
  • Click on new task, I named mine “tv_on”, add an action,
  • Search for “secure” and click on “Secure Settings”, go into the configuration. Go to actions, wake device, I used the default settings, CLICK ON THE SAVE BUTTON UP TO OR IT WONT WORK. Back out after this to test.
  • This is for us folk that have CEC enabled to go to sleep WITH their shield. So either press the power button on your tv or go down to the power option on the Shield and press “Sleep”. Your tv should now be off.
  • Go to any browser and put in this URL
  • http://192.168.12.101:1817/?message=tv_on
  • replace with your Shield IP and replace message with whatever you have being filtered for your on command. Once you press enter your TV should turn on.
  • Once its turns on go down to Power and do a Restart to make sure the WIFI service task that runs on boot (made in first step) is working properly. Repeat the above steps and see if it still works after the restart. If it doesn’t you may need to reconfigure AutoRemote

“Off” Command

  • Download “ADB Shell [Tasker]” from play store
  • Open tasker and go to profiles. Create new profile, Event, search for autoremote, go into configuration, Click on message filter.
  • Enter something simple, mine is “tv_off” (without quotes) then press ok, click on “case insensitive”, press back button twice.
  • Click on new task, I named mine “tv_off”, add an action,
  • Search for “adb” and click on “remote ADB Shell Configuration” and click the configuration button
  • Ip address: localhost
  • Port:5555
  • Adb shell command: “input keyevent KEYCODE_POWER” (without quotes)
  • Press the check mark up top
  • Scroll down to “IF” and press the plus sign. We are now going to use a built in screen status variable in tasker. Click on the Global variables button (the button to the left of the coffee mug) and scroll down to “screen” and click it.
  • It should output the value “%SCREEN” (all caps without quotes) This didn’t work for me so I had to manually type %SCREEN.
  • Click the button to the left of “value”
  • Change it to “matches”
  • In value enter “on” (without quotes) This task will only run if the screen Variable is set to ON.
  • Time to test.
  • Go to any browser and put in this URL
  • http://192.168.12.101:1817/?message=tv_off
  • replace with your Shield IP and replace message with whatever you have being filtered for your of command.
  • your tv and shield should now turn of/go to sleep.
  • Make sure to press it again so that we know it is truly an off button only.

Opening apps “with power on included” (Sling tv, Hulu, Kodi)

  • Open tasker and go to profiles. Create new profile, Event, search for autoremote, go into configuration, Click on message filter.
  • Enter something simple, mine is “open_kodi” (without quotes) then press ok, click on “case insensitive”, press back button twice.
  • Click on new task, I named mine “kodi”, add an action,
  • Click on “task” and then “perform task”, press the search button on the right in the “name” column and go to the “TV_On” task that you created earlier. Then press the back button
  • Add another action, Click on “App” then click on launch app
  • Select the app that you want to launch (kodi) then press back once you have selected it.
  • Time to test.
  • Turn the tv off or put shield to sleep (they should do the same thing CEC)
  • Go to any browser and put in this URL
  • http://192.168.12.101:1817/?message=open_sling
  • replace with your Shield IP and replace message with whatever you have being filtered for your on command. .
  • your tv and shield should now turn on and once if it booted “kodi” should be on the screen.

kodi favorites Menu

  • Download “AutoWeb” from play store (you have to sign up for the beta first and it can take up to an hour to show in the play store)

  • Open AutoWeb, click on “Your Web Services”,

  • Press the plus button up top and go to “import”, scroll down until you see “Kodi” and put a check mark. After this click the ok button.

  • Once it is added click on the Web Service “kodi” , scroll down to Channel Guide and press and hold this section. Click on copy, then click the top right plus sign. It will ask if you want help say “NO”

  • Then it will say “Paste or new” You want to say Paste. Rename it to “favourites” (yes I know this spelling is off) Once you paste it you have to back out of that section and click on the “Kodi” Web service once again.

  • Scroll all the way to the bottom and you should see “Channel Guide: Not Tested Yet”, Press and hold it and click on edit API Config. Change name and config to “favourites”.then press OK

  • Now tap on the same Icon. And it will say “which to edit?” Press on “input”

  • Parameters screen comes up with request option. Click on request.

  • Change description to “favourites” and take a look at the default value (should be in JSON format)

  • All you are going to change is “tvguide” to “favourites” and then press ok. Now press back about 4 times to leave the AutoWEb section.

  • Open tasker and go to profiles. Create new profile, Event, search for autoremote, go into configuration, Click on message filter.

  • Add an action, Enter something simple, mine is “open_favorites” (without quotes) then press ok, click on “case insensitive”, press back button twice.

  • Click on new task, I named mine “favorite”, add an action,

  • Click on “task” and then “perform task”, press the search button on the right of the “name” column and go to the “kodi” task that you created earlier. Then press the back button

  • so right away we have a task that will turn the TV on and open kodi. Now we need it to go to our favorites

  • Add another action to the same “favorite” task.

  • Search for “AutoWeb Web Service” and click the configuration button

  • Click on “API”, Then click on Kodi

  • Click on “API Action”, scroll down to find “favourites”

  •   Go down to “kodi port” and enter your kodi port.  Mine is 8080
    
  • Ip address should be the same as you Shield instance. Then press the check mark on top when finished.

  • Press back and test the plugin by turning the TV off first or putting Shield to sleep.

  • Go to any browser and put in this URL

  • http://192.168.12.101:1817/?message=open_favorites

  • replace with your Shield IP and replace message with whatever you have being filtered for your on command. .

  • your tv and shield should now turn on and once if it booted “kodi favorites” should be on the screen.

Integrating into Home assistant

rest_command:
  tv_on:
    url: 'http://192.168.12.101:1817/?message=tv_on'
  tv_off:
    url: 'http://192.168.12.101:1817/?message=tv_off'
  open_sling:
    url: 'http://192.168.12.101:1817/?message=open_sling'
  open_favorites:
    url: 'http://192.168.12.101:1817/?message=open_favorites'

EDIT: I have changed to Curl commands because sometimes the REST get commands were not cutting it.
open_kodi: ‘curl -k “http://192.168.1.16:1817/?message=kodi”’

open_sling: 'curl -k "http://192.168.1.16:1817/?message=sling"'

open_search: 'curl -k "http://192.168.1.16:1817/?message=search"'

open_favorites: 'curl -k "http://192.168.1.16:1817/?message=favorites"'

open_friends: 'curl -k "http://192.168.1.16:1817/?message=friends"'

open_big_bang_theory: 'curl -k "http://192.168.1.16:1817/?message=big_bang_theory"'

tv_off: 'curl -k "http://192.168.1.16:1817/?message=tv_off"'

wake_tablet1: 'curl -k "http://192.168.1.8:1817/?message=wake_tablet1"'

Again I apologize for this poorly written tutorial. Im attaching a decent youtube tutorial that I just made on my phone that shows a little more what im talking about

Youtube tutorial done on my phone lol

4 Likes

A lot to read here but will be coming back to this. Sounds really interesting and I have the same basic components and devices.

Thanks for sharing this!!

1 Like

I didn’t know ADB Shell [Tasker], it’ll be really useful, thanks!

Its very convenient to actually be able to have a local ADB session. Especially one that integrates with tasker. Let me know if you can find out how to use the Export Variables in the %ouput1 section. Im trying to use it to issue the off/on screen status in HA but I got confused.

I’ve been meaning to get around to doing something like this but know it will take a decent amount of time. Since I just use kodi 95% of the (when I turn on the shield it is already on the app I want) I can’t motivate myself to do it.

But if I do this eventually id use ifttt to make some custom google home commands like “turn on netflix”

Or you could use emulated hue to do the same thing.

Nice write up

Hi @benjimatt,
Could you please explain how to donwload the apps to Shield?
I can`t find them on Google Play.

Thanks :slight_smile:

search for them on google play on a computer and download them to the device that way.

Howdy, my side-loaded tasker has just “expired”. Does anybody have a way of installing legit tasker on Shield TV? I’d be happy to buy it, but unfortunately can’t do it without rooting the device…
I’m afraid to root the Shield, - Netflix or other apps may stop working then.

Same here, I have actually purchased it in the google play store but the order code in the email doesn’t work.

Did you find a way?

Thanks for this write up learnt ALOT.

I used MQTT client instead of AutoRemote.

Quick tip for anyone who has issues with ADB - I had to set the timeout to 5 seconds as it was erroring.

Sorry to drag back an old thread, but I’m trying to set up something very similar. Do you know if there is any way to control the Sling TV app? I want to be able to launch a specific channel on boot (or message). I’m thinking the only way to do this would probably be to emulate remote button presses as a kind of macro thing, but it’s a bit clumsy.