Directv Program Watching Announcement and History Log

This is an automation project.

Using the directv media_player component, I create an automation script that makes a voice announcement about the current program watching (using google tts service) and also creates a persistent notification and a record in the log that could be used to see the program history.

My future goal is try to use it to make some interesting announcements to my young son to “filter” the amount of time that he watch the TV. Something like " Leo you watch enough TV today!" …

This first approach will make the program announcement and log the programs watched.

In order to do this we need:

  1. Configure the directv media_player component
  2. Configure the automation conditions
  3. Configure the script that:
    3.1 Make the announcement (tts)
    3.2 Create the log record
    3.3 Create the persistent

1. Configure the directv media_player

Add to the configuration.yaml:

media_player:
  platform: directv
  host: IP_ADDRESS #Put your Directv IP Address

After that, reload your configuration.yaml and you will see a new device named directv_receiver like this:

2. Configure the automation conditions

I consider that this automation script will only be executed when the directv_receiver will be in ‘playing’ state and between 6am (the time when we normally wake up and start the process with my son to be ready to go to the school). When this happens the system will execute the script named directv_program.

The automation script is named directv_announcement.yaml an was located in /config/automation/

3. Configure the Script

This is the script that will do three things:

  1. Make the voice announcement (I use a custom media_player component bluetooth_speaker to make the voice announcements, you can check a previous post about it)
  2. Create a log entry
  3. Create a persistent-notification

After the script runs you can see the persistant-notification like this:

Also you can see the information related in the Logbook:

If we click on the directv_watching we can see the history:

And also we can check the information in the History:

2 Likes

I’m so glad none of this existed when I was a kid. I would have gotten into SO much trouble with the weird crap I was watching.

Thanks for the great writeup. I am able to see my DirecTV receiver but not my genies. Any way to show whats playing on DirecTV genies?

I’m looking for a way to see my DirecTv genies as well. Hopefully someone has an answer.

Wondering if anyone has looked at using this as the basis to scrobble with tract.tv.

Looks viable but I just installed HA 5 days ago so still VERY early in my exploration. However I was an Engineer for 20 years so I’m sure I could adapt something available or will down the road have to see if I can write something myself.

Unfortunately the Trakd integration that is available seems SPECIFICALLY focused on presenting upcoming media via the Lovelace UI/extension. I more interested in something that will do content matching, scrabble or AT LEAST mark content as WATCH at competition of program (like my Plex plugin currently does).

Finally, while I am NOT a python dev I did come across a promising library, and given much of HA is written in Python, perhaps another member of the HA community will be able to leverage this library- [trakt.py · PyPI](https://Python based Trak.tv library).

Thanks for any help… (on this ancient thread)…
Tom

Genies use an internal IP address. You can get information from them using the SHEF API and knowing the clientAddr for the Genie. The clientAddr is the mac I’d of the box without the : separators.

I am finishing a complete remote for DirecTV which can support main boxes and connected genies. Would be happy to send you JS library for being able to get this info and also send most all commands the remote can so.

That’s GREAT news!

Perhaps there is again hope for my desire to find or create a solution to scrob DirecTV to Trackd…

OK. Here’s some tools for you to do what you want. Assuming you have the DirecTV integration all working. Let’s start by creating a rest sensor to get the devices in your networked Genie. This would be the main Genie and all the connected clients. This sensor should do the trick (change to your own IP address for your main Genie, if you do not know that go into the setup on the DirecTV box and look it up):

- platform: rest
  name: directv_getlocations
  resource: http://192.168.1.235:8080/info/getLocations
  value_template: "{{ value_json.status.code }}"
  json_attributes: 
    - locations

Now, you do not really need this as a sensor unless you want to use templates. Equipment changes are rare, so you could just enter that URL into a browser and read what it says in the JSON response. It should be like this:

image

Now, the “clientAddr” are the addresses for any connected mini. The main Genie is always “0” (MASTER BEDROOM in my case).
So, I can create another sensor that gets the currently playing program (if any). I do it this way, replace the {clientAddr} with your own one obtained above for the mini client you want. Note, the clientAddr is just the mac address of the connected mini without the “:”'s …

- platform: rest
  name: directv_deck_playing
  resource: http://192.168.1.235:8080/tv/getTuned?clientAddr={clientAddr}
  value_template: "{{ value_json.title }}"
  json_attributes:
    - callsign
    - episodetitle
    - major

As I said, you could get more information if you wanted like the rating or recording status. Anything here:

image

If I debugged that, I would see this:

And if I looked at history for the sensor, I can see all of it:

Now, how you wish to collect these stats and do something with them is beyond what I am implementing. I am creating remotes for all of my DirecTVs using custom buttons. Because I wanted the current channel, callsign and title I did those sensors. There is more information available in the SHEF API.

My current remotes look like this and are fully functional (except that mini Genies cannot be powered on/off through the SHEF API. Even through it returns a status code of 200, OK … it will not power off or power on mini genies. The power does work for the main Genie box.

One note, I could have gotten all that from the actual media player instead of my custom sensors. I see that from the above post. in looking at the media player for the DirecTV genie on my Deck, I see this:

I may change to remove my custom sensors, as the information is already there.