Directv Stream Android TV

I am relatively new to HA. My primary configuration is to control everything in my media room. I have made great progress on the lights, lighting scenes, and some controls of my TV / movie viewing. I am running into issues controlling my DirecTV Stream Set top box. It’s running Android TV but obviously has a custom build.

I’m able to use the Android Remote to open apps using something like this:

action: remote.turn_on
data:
activity: https://www.paramountplus.com
target:
entity_id: remote.theater

but can’t find the right deep link to go to the base DirecTV stream app. Likewise, I can’t change the channels in the DirecTV app. Has anyone figured this out?

My next attempt will be to purchase a IR and Bluetooth enabled hub. My hope is that I can replicate all of the DirecTV set top box’s remote features. Does anyone have a recommendation or has done this before?

I haven’t been able to find much on this topic. It doesn’t look like this thread helped you any. Thought I would post and ask if you made any progress?

This is deeplink to play foxnews:

am start -a android.intent.action.VIEW -d dtvnow://deeplink.directvnow.com/play/channel/FNCHD/5f3323ab-7390-8fcc-177f-bf9cc8000bcf -n com.att.tv/com.clientapp.MainActivity

From that, a script to Tune to any channel … now this script includes assumption
in my setup where I have naming conventions to parse data:

variables:
  tv: media_player.office_vizio
  callsign: FNCHD
  channel_id: 5f3323ab-7390-8fcc-177f-bf9cc8000bcf
  tvname: "{{(tv.split('.'))[1]}}"
  firestick: media_player.{{(tvname.split('_'))[0]}}_fire_tv
  ip: >-
    {{state_attr('sensor.vizio_tvs','tvs') | selectattr('name','eq', tvname) |
    map(attribute='ip') | join(',') }}
  port: >-
    {{state_attr('sensor.vizio_tvs','tvs') | selectattr('name','eq', tvname) |
    map(attribute='port') | join(',') }}
  auth: >-
    {{state_attr('sensor.vizio_tvs','tvs') | selectattr('name','eq', tvname) |
    map(attribute='auth') | join(',') }}
sequence:
  - if:
      - condition: template
        value_template: "{{ is_state(tv, 'off') }}"
    then:
      - action: media_player.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: "{{ tv }}"
  - if:
      - condition: template
        value_template: "{{ is_state(firestick, 'off') }}"
    then:
      - action: media_player.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: "{{ firestick }}"
  - action: androidtv.adb_command
    metadata: {}
    data:
      command: >-
        am start -a android.intent.action.VIEW -d
        dtvnow://deeplink.directvnow.com/play/channel/{{ callsign }}/{{
        channel_id }} -n com.att.tv/com.clientapp.MainActivity
    target:
      entity_id: "{{ firestick }}"
    enabled: true
  - action: shell_command.vizio_directv
    metadata: {}
    target:
      entity_id: "{{tv}}"
    data:
      ip: "{{ip}}"
      port: "{{port}}"
      auth: "{{auth}}"
alias: Tune DirecTV Channel
description: Tune DirecTV app on Firestick to specific channel

You would not have to go that deep, but the key is here:

  - action: androidtv.adb_command
    metadata: {}
    data:
      command: >-
        am start -a android.intent.action.VIEW -d
        dtvnow://deeplink.directvnow.com/play/channel/{{ callsign }}/{{
        channel_id }} -n com.att.tv/com.clientapp.MainActivity
    target:
      entity_id: "{{ firestick }}"
    enabled: true

So you need the callsigns and the channel_id’s from DirectTV.

I have those in a “static” sensor. I created that from an XML (original JSON taken from DirecTV website):

<dtvchannels>
   <channel>
      <resourceId>bd2c50b5-d8cf-a53d-d6f8-a78b5afec658</resourceId>
      <channelName>FOX-KTVU</channelName>
      <channelNumber>2</channelNumber>
      <callSign>KTVU</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/bd2c50b5-d8cf-a53d-d6f8-a78b5afec658/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>76c08e6f-2131-42ab-25a3-a255b79f0693</resourceId>
      <channelName>CW-KRON</channelName>
      <channelNumber>4</channelNumber>
      <callSign>KRON</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/76c08e6f-2131-42ab-25a3-a255b79f0693/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>491d467f-eaaa-eafd-f05c-9afbe6d42fa5</resourceId>
      <channelName>CBS-KPIX</channelName>
      <channelNumber>5</channelNumber>
      <callSign>KPIX</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/491d467f-eaaa-eafd-f05c-9afbe6d42fa5/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>a8f0dda6-aa59-b180-32e7-ee1003adb30c</resourceId>
      <channelName>ABC-KGO</channelName>
      <channelNumber>7</channelNumber>
      <callSign>KGO</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/a8f0dda6-aa59-b180-32e7-ee1003adb30c/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>3f0d92a5-3915-2be0-19af-cda0ead21d6b</resourceId>
      <channelName>PBS-KQED</channelName>
      <channelNumber>9</channelNumber>
      <callSign>KQED</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/3f0d92a5-3915-2be0-19af-cda0ead21d6b/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>d9b7cc7d-f692-af6e-bbab-a74784790fff</resourceId>
      <channelName>NBC-KNTV</channelName>
      <channelNumber>11</channelNumber>
      <callSign>KNTV</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/d9b7cc7d-f692-af6e-bbab-a74784790fff/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>ff8287d8-1a4a-8748-5b87-23aa02784dad</resourceId>
      <channelName>Univision-KDTV</channelName>
      <channelNumber>14</channelNumber>
      <callSign>KDTV</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/ff8287d8-1a4a-8748-5b87-23aa02784dad/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>c46d1fbc-8782-7cf9-f8a0-9a7e3100b896</resourceId>
      <channelName>PBS-KRCB</channelName>
      <channelNumber>22</channelNumber>
      <callSign>KRCB</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/c46d1fbc-8782-7cf9-f8a0-9a7e3100b896/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>4b9576f1-cb13-a168-943e-50f099567a5b</resourceId>
      <channelName>KICU</channelName>
      <channelNumber>36</channelNumber>
      <callSign>KICU</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/4b9576f1-cb13-a168-943e-50f099567a5b/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>47c11444-708f-9151-8c3f-2337bdb47f9a</resourceId>
      <channelName>KPYX</channelName>
      <channelNumber>44</channelNumber>
      <callSign>KPYX</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/47c11444-708f-9151-8c3f-2337bdb47f9a/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>f2c92585-dbf1-3fdc-9d3b-38cf347edc2f</resourceId>
      <channelName>TMO-KSTS</channelName>
      <channelNumber>48</channelNumber>
      <callSign>KSTS</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/f2c92585-dbf1-3fdc-9d3b-38cf347edc2f/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>83321f4e-2ac2-9dc4-a1fd-7b0a0f8c1e5f</resourceId>
      <channelName>MeTV</channelName>
      <channelNumber>77</channelNumber>
      <callSign>METV</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/83321f4e-2ac2-9dc4-a1fd-7b0a0f8c1e5f/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>9fd00aad-1cc7-cf23-ba3e-bae853bd6165</resourceId>
      <channelName>Cozi TV</channelName>
      <channelNumber>80</channelNumber>
      <callSign>COZI</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/9fd00aad-1cc7-cf23-ba3e-bae853bd6165/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>3097b4cc-3b54-14e3-c801-796f2316040f</resourceId>
      <channelName>GRIT</channelName>
      <channelNumber>81</channelNumber>
      <callSign>GRIT</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/3097b4cc-3b54-14e3-c801-796f2316040f/chlogo-bwdb-player/120/91</imageUrl>
   </channel>
   <channel>
      <resourceId>19a0169f-323e-b251-99e0-56b7209b4dca</resourceId>
      <channelName>BounceTV</channelName>
      <channelNumber>82</channelNumber>
      <callSign>Bounce</callSign>
      <imageUrl>https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/19a0169f-323e-b251-99e0-56b7209b4dca/chlogo-bwdb-player/120/91</imageUrl>
   </channel>

** shortened for brevity **

Happy to send anyone the data for this, Putting it together, I created a custom PAD to select any TV station:

Updated as I found the URL set for colo logos, put it into a scrollable and fiterable container:

im interested in the json for the callsigns and the channel_id

For which?

DirecTV Stream
DirecTV (Satellite)

They are different. Note, I stopped using this to change channels in DirecTV Stream, I cannot see a way to control is “as an app”. But I did extract the data and load it.

1 Like

I posted versions here:

The XML is more complete

1 Like

I was interested in direct TV stream.

Thank you for this.

Do you think there are deeplinks to go to dvr, guide, home, and channels to LIVE4k and LIVE4k2?

For the 2 channels, I saw their callsign in the json logos but couldn’t find their channel IDs in the xml or json.

Hello,

I am also interested if DirecTV does have Deeplinks for things like Guide and DVR. I am using the app aswell.

I above code works IF you have the app installed on a Fire TV or Fire Stick. I do not. My DirectTV Stream app is installed as a native app in my Vizio. For things like Guide or Source I just use the dPad commnds and the TV Gui,

I you have “old” DirecTV (not stream but satellite) youu could use rest_commands with variables like this:

directv_tune:
  url: http://{{ ipAddress }}:8080/tv/tune?clientAddr={{ clientAddr }}&major={{ channel }}&minor=65535
vizio_processkey:
  url: 'https://{{ ip }}:{{ port }}/key_command/'
  method: put
  content_type: "application/json"
  headers:
    AUTH: '{{ auth }}'
  payload: '{"KEYLIST": [{"CODESET": {{ codeset | int }},"CODE": {{ code | int }},"ACTION":"KEYPRESS"}]}'
  verify_ssl: false

These are all documented here: https://github.com/kbrown01/Vizio_DirecTV

1 Like

Thanks kbrown01 for this.

Local Channels:
I went looking for my local channels, and after some poking around I managed to find out a way. There may be other ways to do this, but this worked for me…
Login to the DirecTV Web app to actually watch streaming, and go to the Guide and find your local channel. Goto the logo for that channel, and do a browser inspection on the logo. The inspection should reveal a URL that contains the channel_id.

For example, for one of my local channels the inspect reveals:

<div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu" style="background-image: url(&quot;https://dfwfis.prod.dtvcdn.com/catalog/image/imageserver/v1/service/channel/c9ff5ab8-6889-3d46-7b35-cb20a408b4b2/chlogo-clb-guide/60/45&quot;);"></div>

channel-id: is the string c9ff5ab8-6889-3d46-7b35-cb20a408b4b2.
callsign: I find the name doesn’t matter so much. It could be WXYZHD or it could just be AAAABB.

That is how I got the information at one time. Wrote code that takes that page, downloads and parses the content to XML.