This project is to help with using Home Assistant to manage Tivo devices
- Home Assistant
- Tivos
- Enabling the network remote access on the Tivos
- Google Account (for DialogFlow and Actions)
I have Home Assistant running in a Docker container on a Raspberry Pi. I followed the documentation from the Home Assistant website and am using the 'homeassistant/aarch64-homeassistant:latest' image.
[Unit]
Description=HomeAsssistant Docker Container
Documentation=https://www.home-assistant.io/docs/installation/docker/
After=network.target docker.service
Requires=docker.service
[Service]
StandardOutput=append:/var/log/docker-homeassistant.log
StandardError=inherit
TimeoutStartSec=300
RestartSec=10
Restart=always
ExecStartPre=-/usr/bin/docker rm -f homeassistant
# This takes too long, so it's commented out and I do it manually every so often
# ExecStartPre=-/usr/bin/docker pull homeassistant/aarch64-homeassistant:latest
ExecStart=/usr/bin/docker run --rm --name="homeassistant" --net=host \
-v /srv/docker/homeassistant:/config -v /etc/localtime:/etc/localtime:ro \
homeassistant/aarch64-homeassistant:latest
[Install]
WantedBy=multi-user.target
This is just the relevant parts of my configuration.yaml. There is obviously more.
tts: - platform: google_translate dialogflow: google_assistant: !include google_assistant.yaml shell_command: !include shell_commands.yaml intent_script: !include intent_scripts.yaml
- tivo_tivobutton: Press the Tivo Button on a Tivo
- tivo_livetv: Press the Live TV Button on a Tivo
- tivo_setch: Change the channel on a Tivo
- tivo_play: Press Play on a Tivo
- tivo_pause: Press Pause on a Tivo
- tivo_record: Record the currently active show with default settings on a Tivo
- tivo_enter: Send the Enter button to a Tivo
- Assuming Home Assistant is installed in /srv/docker/homeassistant (you don't have to install here, substitute your Home Assistant install path for mine)
- Create a 'bin' directory in /srv/docker/homeassistant and copy the tivo-scripts to that directory
- Modify configuration.yaml to include the lines from my configuration file above.
- Copy the shell_commands.yaml and intent_scripts.yaml to the same directory as your configuration.yaml file.
- Restart Home Assistant.
- Log into Google DialogFlow
- Configure DialogFlow following the Home Assistant DialogFlow documentation
- Create @channel Entity:
- Leave 'Define synonyms' checked; check 'Regexp entity' and 'Allow automated expansion'
- Add '(channel )?\d{3}' for a row.
- Add '(channel )?\d \d \d' as another way of inputing the same thing with spaces in another row.
- Add '(channel )?(five|six|seven|eight|nine) (oh|zero|one|two|three|four|five|six|seven|eight|nine) (oh|zero|one|two|three|four|five|six|seven|eight|nine)' in case Google interprets the channel numbers as words for a third row.
- Add specific channels in another row with '(CW|NBC|Fox|my TV|ABC|CBS|USA|TNT|TBS|FX|WGN|ESPN|masn|MASN|NFL Network|Tennis Channel|CNN|CNBC|Weather Channel|Discovery Channel|National Geographic|Animal Planet|TLC|Lifetime|QVC|Food Network|HGTV|TruTV|Syfy|Sci-Fi|A and E|a n e|Bravo|Ovation|BBC America|Comedy Central|pop|freeform|MTV|VH1|AMC|IFC|TV Land|Nick|Nickelodeon|Cartoon Network|Disney Channel|HBO)'
- Create @tv_device Entity:
- Leave 'Define synonyms' checked and nothing else.
- Enter names for your Tivos as the reference value and different words for how you might refer to it as synonyms. For example, my 'tivo-familyroom' can sometimes be referred to as 'Family Room Tivo', 'Family Room TV', and 'God Damn Tivo'. So I added those synonyms. Note that 'tivo-familyroom' is the DNS name for my Tivo for my home network.
- Add synonyms for all of your Tivos.
- Either set up DNS or /etc/hosts file entries on your Home Assistant server for all of your tivos so that Home Assistant can access the tivos using the 'reference value' from the previous @tv_device Entity in the scripts.
- Create Intents for each action you want DialogFlow to perform. I have:
- ChangeTivoChannel:
- Add Training Phrases:
- 'to channel 504 on God Damn Tivo'
- 'Change God Damn Tivo to channel 504'
- Select "channel 504"; a popup should let you assign it to an Entity, choose @channel
- This tells DialogFlow that "channel 504" is a variable associated with @channel
- Select "God Damn Tivo"; a popup should let you assign it to an Entity, choose @tv_device
- This tells DialogFlow that "God Damn Tivo" is a variable associated with @tv_device
- Enter 'ChangeTivoChannel' as Action Name (this connects this Intent to the intent_script in Home Assistant) and add entries for @channel, @channel, $channel with a prompt of "To which Channel?" and @tv_device, @tv_device, $tv_device with a prompt of "Which Tivo?"
- Under Responses, enter "Channel changed", check "Set this intent as end of conversation", select Google Assistant and check 'Use responses from the DEFAULT tab as the first responses'.
- Under Fulfillment, check 'Enter webhook call for this intent'
- Click Save
- Add Training Phrases:
- LiveTVTivo
- Add Training Phrases: 'press Live TV Button on God Damn Tivo', 'press the Live TV Button on God Damn Tivo', 'press Live TV on God Damn Tivo' and any other combinations you may use to tell it to press Live TV.
- Add LiveTVTivo as the Action Name.
- Add @tv_device, @tv_device, $tv_device, "Which Tivo?" as a parameter.
- Under Responses, add a response like "Sending Live TV" and along with the other settings similar to ChangeTivoChannel
- Do the same for "PauseTivo", "PlayTivo", "RecordTivo", and "TivoButtonTivo" (matching the right Action Name to the intent_script in Home Assistant)
- ChangeTivoChannel:
- Click 'Integrations'
- Under 'Google Assistant', click 'Integration Settings'.
- Under 'Explicit invotation', enter one of your Intents that you want to be the "default intent". I chose 'ChangeTivoChannel'.
- Click 'Manage Assistant App'. This opens Google Actions Console
- Under Quick Setup, give a display name to the Invocation. This is how you invoke your app: "Hey, Google, tell 'My App Name' to change the God Damn Tivo to channel 504". There are restrictions on what you can use (more than 1 word, can't use articles like the/an/a as one of the words, ...). One example is 'Channel Fairy'.
- Click the Test heading to enable test-mode.
- I believe the Action is already set up due to setting up the integration from DialogFlow.
- That may be everything that needs to be done with the Actions Console... I can't remember.
Now test your integration with: 'Hey Google, tell Channel Fair to press the Live TV button on My Main Tivo'