Skip to content

merdely/ha-tivo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Home Assistant / Tivo Integration

This project is to help with using Home Assistant to manage Tivo devices

Requirements

  1. Home Assistant
  2. Tivos
  3. Enabling the network remote access on the Tivos
  4. Google Account (for DialogFlow and Actions)

My Set Up

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.

My systemd unit file

[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

My Home Assistant Configuration file

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

My Tivo Scripts

Set Up Instructions

  1. Assuming Home Assistant is installed in /srv/docker/homeassistant (you don't have to install here, substitute your Home Assistant install path for mine)
  2. Create a 'bin' directory in /srv/docker/homeassistant and copy the tivo-scripts to that directory
  3. Modify configuration.yaml to include the lines from my configuration file above.
  4. Copy the shell_commands.yaml and intent_scripts.yaml to the same directory as your configuration.yaml file.
  5. Restart Home Assistant.
  6. Log into Google DialogFlow
  7. Configure DialogFlow following the Home Assistant DialogFlow documentation
  8. Create @channel Entity:
    1. Leave 'Define synonyms' checked; check 'Regexp entity' and 'Allow automated expansion'
    2. Add '(channel )?\d{3}' for a row.
    3. Add '(channel )?\d \d \d' as another way of inputing the same thing with spaces in another row.
    4. 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.
    5. 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)'
  9. Create @tv_device Entity:
    1. Leave 'Define synonyms' checked and nothing else.
    2. 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.
    3. Add synonyms for all of your Tivos.
  10. 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.
  11. Create Intents for each action you want DialogFlow to perform. I have:
    • ChangeTivoChannel:
      1. Add Training Phrases:
        • 'to channel 504 on God Damn Tivo'
        • 'Change God Damn Tivo to channel 504'
      2. 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
      3. 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
      4. 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?"
      5. 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'.
      6. Under Fulfillment, check 'Enter webhook call for this intent'
      7. Click Save
    • LiveTVTivo
      1. 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.
      2. Add LiveTVTivo as the Action Name.
      3. Add @tv_device, @tv_device, $tv_device, "Which Tivo?" as a parameter.
      4. 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)
  12. Click 'Integrations'
    1. Under 'Google Assistant', click 'Integration Settings'.
    2. Under 'Explicit invotation', enter one of your Intents that you want to be the "default intent". I chose 'ChangeTivoChannel'.
    3. 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'

About

Integrating Home Assistant with Tivo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages