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:
- Configure the directv media_player component
- Configure the automation conditions
- 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:
- 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)
- Create a log entry
- 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: