Tune HDHomerun Antenna Channel on NVIDIA SHIELD using Google Assistant, VLC

The outcomes of this project are:

  • Tune to specific HDHomerun antenna channels using VLC
  • Switch between channels
  • Use Google Assistant to be able to tune and switch channels
  • Create a “Room Remote” using lovelace with channel buttons

Requires the following being functional:

  • Integrate NVIDIA SHIELD into Home Assistant using ADB functionality (link)
  • Google Assistant Cloud integration (link)
  • VLC app installed on the SHIELD
  • HDHomerun can tune channels using their app (or a supported variant)

Example of my lovelace room remote:

Step 1: Create a script to kill VLC (required to switch between channels):
Note down the script numbers and how they map to your channels as you’ll need them later to create the room remote.

'1591980710565':
  alias: Shield - Family Room - Kill VLC
  sequence:
  - data:
      command: am force-stop org.videolan.vlc
    entity_id: media_player.nvidia_shield
    service: androidtv.adb_command
  mode: single
  icon: mdi:vlc

Be sure to update the entity_id as needed throughout

Step 2: Create scripts for each of the channels you want to use:

'1591981093286':
  alias: Shield - Family Room - Channel 11.1 (KTVT-DT CBS)
  sequence:
  - service: script.1591980710565
  - data:
      command: am start -a android.intent.action.VIEW -d http://192.168.1.XXX:5004/auto/v11.1
        -n org.videolan.vlc/.gui.video.VideoPlayerActivity
    entity_id: media_player.nvidia_shield
    service: androidtv.adb_command
  mode: single
  icon: mdi:vlc

Note that you will need to replace the IP address and channel in the above command. You can get the entire URL from here: http://hdhomerun.local/lineup.html on your local network if you don’t know the IP address of your HDHomerun. In your channel list, right-click on the channel number and you can use the copy link option.

Step 3: Make sure scripts are being shared with Google
In the HA UI, Go to Configuration > Home Assistant Cloud > Google Assistant Manage Entities > make sure the scripts are permitted to be exposed to google assistant

Step 4: Setup a routine in Google Assistant
Google Assistant > Routines > Manage Routines > + Add a routine:

  1. Add “When” information: “Turn on channel 11” or “Watch channel 11” or “Turn on CBS” or “Watch CBS”
    (or whatever makes sense to you)

  2. Add “Assistant will” information: Adjust scenes > check the appropriate script from HA
    (Mine is “Shield - Family Room - Channel 11.1”)

Step 5 (optional): Add remote button images to config directory:
Place the button images you want to use in the following location:
*/config/www/lovelace
If you don’t want pictures, use whatever else.

Step 6: Create lovelace “Room Remote”:

cards:
  - entity: media_player.nvidia_shield
    type: media-control
  - cards:
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/kdfw4.jpeg
        tap_action:
          action: call-service
          service: script.1591979439834
        type: picture
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/kxas5.jpeg
        tap_action:
          action: call-service
          service: script.1591979439844
        type: picture
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/wfaa8.jpeg
        tap_action:
          action: call-service
          service: script.1591979439934
        type: picture
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/ktvt11.jpeg
        tap_action:
          action: call-service
          service: script.1591981093286
        type: picture
    type: horizontal-stack
  - cards:
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/kera13.png
        tap_action:
          action: call-service
          service: script.1591979449834
        type: picture
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/kera13_2.png
        tap_action:
          action: call-service
          service: script.1591981003176
        type: picture
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/kdaf33.jpeg
        tap_action:
          action: call-service
          service: script.1591981003276
        type: picture
      - hold_action:
          action: call-service
          service: script.1591980863361
        image: /local/lovelace/ion68.jpeg
        tap_action:
          action: call-service
          service: script.1591982223627
        type: picture
    type: horizontal-stack
type: vertical-stack

I also created a script to wake up the SHIELD and one to go home and use them in my channel scripts, just in case the SHIELD is sleeping or in another app when I tell google to turn on a channel. They are below:

Wakeup:

'1591980796379':
  alias: Shield - Family Room - Wakeup
  sequence:
  - data:
      command: WAKEUP
    entity_id: media_player.nvidia_shield
    service: androidtv.adb_command
  mode: single
  icon: mdi:play-network

Home:

'1591980863361':
  alias: Shield - Family Room - Home
  sequence:
  - data:
      command: HOME
    entity_id: media_player.nvidia_shield
    service: androidtv.adb_command
  mode: single
  icon: mdi:play-network
1 Like