Control TiVo box over telnet


#182

Last channel function added. Use the previous track button for it. I’ve made the next track button into a toggle for the +1 functionality, i.e. once to switch to the +1 channel, a second to switch back to normal.


#183

HI there,

I’m new to the HA setup, I only installed this yesterday on Windows 10 to test out the feasibility before I go down the PI route.

I have tried to install your plugin, and I am getting the following error:

2018-07-15 08:54:08 INFO (MainThread) [homeassistant.setup] Setting up media_player
2018-07-15 08:54:08 ERROR (MainThread) [homeassistant.setup] Error during setup of component media_player
Traceback (most recent call last):
File “c:\users\xxx\appdata\local\programs\python\python37\lib\site-packages\homeassistant\setup.py”, line 146, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
AttributeError: module ‘custom_components.media_player’ has no attribute ‘setup’

I have installed the plugin in the C:\Users\xxx\AppData\Roaming.homeassistant\custom_components\media_player folder, which I assume is the right thing to do.

I’m pretty sure this will be something I’ve done wrong, but if you have any pointers that would be helpful!


#184

Can you show us your configuration? It looks like it is trying to use a component called “media_player” which makes me think something isn’t right in there.


#185

Sure, I’ve truncated it after BBC1 as that is just pasted from your config file anyway:

homeassistant:

Name of the location where Home Assistant is running

name: Home

Location required to calculate the time the sun rises and sets

latitude: 0
longitude: 0

Impacts weather/sunrise data (altitude above sea level in meters)

elevation: 0

metric for Metric, imperial for Imperial

unit_system: metric

Pick yours from here:

time_zone: UTC

Customization file

customize: !include customize.yaml

Show links to resources in log and frontend

introduction:

Enables the frontend

frontend:

Enables configuration UI

config:

http:

Secrets are defined in the file secrets.yaml

api_password: !secret http_password

Uncomment this if you are using SSL/TLS, running in Docker container, etc.

base_url: example.duckdns.org:8123

Checks for available updates

Note: This component will send some information about your system to

the developers to assist with development of Home Assistant.

updater:

Optional, allows Home Assistant developers to focus on popular components.

include_used_components: true

Discover some devices automatically

discovery:

Allows you to issue voice commands from the frontend in enabled browsers

conversation:

Enables support for tracking state changes over time

history:

View all events in a logbook

logbook:

Enables a map showing the location of tracked devices

map:

Track the sun

sun:

Weather prediction

sensor:

  • platform: yr

Text to speech

tts:

  • platform: google

Cloud

cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

switch:
platform: telnet
switches:
tivo_guide:
resource: “192.168.0.10”
port: 31339
command_on: “IRCODE GUIDE”
command_off: “IRCODE GUIDE”
command_state: “”
value_template: “”
name: Guide
tivo_info:
resource: “192.168.0.10”
port: 31339
command_on: “IRCODE INFO”
command_off: “IRCODE INFO”
command_state: “”
value_template: “”
name: Info

media_player:

  • platform: braviatv
    host: 192.168.0.212
    name: KitchenTV

  • platform: virgintivo
    default_is_show: false
    default_is_hd: true
    scan_interval: 1
    tivos:
    1:
    name: Virgin V6
    host: 192.168.0.10
    force_hd: true
    2:
    name: Virgin Tivo
    host: 192.168.0.10
    3:
    name: Virgin Pretend
    host: 192.168.0.10
    guide:
    picture_refresh: 30
    channels:
    100:
    name: Virgin Media Previews
    101:
    name: BBC One
    show: true
    hd_channel: 108


#186

Indentation is significant. Could you post your config again, this time using the preformatted text tags?


#187

Sure, I hadn’t noticed that it had affected the formatting!

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 0
  longitude: 0
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: UTC
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

http:
  # Secrets are defined in the file secrets.yaml
  # api_password: !secret http_password
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  # base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
sensor:
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

switch:
  platform: telnet
  switches:
    tivo_guide:
      resource: "192.168.0.10"
      port: 31339
      command_on: "IRCODE GUIDE"
      command_off: "IRCODE GUIDE"
      command_state: ""
      value_template: ""
      name: Guide
    tivo_info:
      resource: "192.168.0.10"
      port: 31339
      command_on: "IRCODE INFO"
      command_off: "IRCODE INFO"
      command_state: ""
      value_template: ""
      name: Info

media_player:
  - platform: braviatv
    host: 192.168.0.212
    name: KitchenTV

  - platform: virgintivo
    default_is_show: false
    default_is_hd: true
    scan_interval: 1 
    tivos:
      1:
        name: Virgin V6
        host: 192.168.0.10
        force_hd: true
      2:
        name: Virgin Tivo
        host: 192.168.0.10
      3:
        name: Virgin Pretend
        host: 192.168.0.10
    guide:
      picture_refresh: 30
    channels:
      100:
        name: Virgin Media Previews
      101:
        name: BBC One
        show: true
        hd_channel: 108

#188

Use berts full example on github - I made the same mistake by only using a few channels but used his full example and it worked.


#189

Oh yeh, I had seen that, but I am using the whole channel list, I have just truncated what I have posted so that it saves posting the whole lot!


#190

Looks ok, although you’ll probably want to remove Tivos 2 and 3. Which means it might be the folder structure. I’m not using this on Windows, but I’ll assume that the path you posted is where Windows puts this stuff. In which case, I’m guessing that under custom_components, you’ve created a file called media_player.py? If so, that’s not right. Your structure should be

custom_components\media_player\virgintivo.py

If that’s not what is wrong, I dunno…


#191

Hi.
Where do i type this command?

sudo apt-get install telnetd

I installed using hass io and when i SSH into the pi it says the command is invalid as i don’t think it is actually connected to the pi’s terminal. Thanks


#192

sudo apt-get install telnet*

Ssh on to your pi. Think you had a typo above,


#193

Hi Bertbert,

No, I do have the correct file path (custom_components\media_player\virgintivo.py), but I don’t know if it’s a WIndows-ism, or a Python version issue?

However, I tried copying the virgintivo.py file into the main components folder, and it works fine. I know this will cause me issues with upgrades etc, but it allows me to have a play.

Not sure what causes the issue with the fact it’s in the custom_components folder, but thanks for your help so far!


#194

Glad you’ve got it sorted for now. Hopefully when you stick it on your Pi, it’ll work ok in the custom components folder.


#196

A few bugfixes and a new function to allow override of the HD auto switching, e.g. when you want to view a regional programme on the SD channel that’s not on the HD one. Just switch back to the SD channel within a few seconds of the HD auto switch and it will now remain on the SD version. As requested by my better half…


#197

Hey, so I’m using this without issue and loving it so thanks for your efforts. One thing though is that if I switch the box to standby my log file up with this error: ‘Virgin V6: timeout on connection, will retry’. Is there any way I can suppress this?


#198

See if that works better for you. It should now just show the failure once when it first happens. It won’t show it again until the Tivo is switched on and off again.


#199

Changed the default behaviour to be that the component disconnects from the Tivo between commands. There doesn’t seem to be any great advantage in staying permanently connected and given that there can only be one telnet session at a time, probably better if I don’t hog it. I only had it like that because the Tivo documentation implied more than one client could be connected at a time listening for updates.

To reinstate the previous behaviour, just use keep_connected: true in your configuration file.


#200

Thank you. This is great.

One thing I have noticed, not sure if it’s due to the latest version, but when watching something recorded in ‘my shows’ the widget in the overview screen shows the box as off. It comes back on if I skip the recording and go back to live tv.

Not a massive problem, but thought you should know.


#201

It’s not new but unfortunately I don’t know if there is anything I can do about it. The Tivo reacts the same whether it is off or playing a recording. In both cases it doesn’t give any response on the telnet session. If anybody knows of a way to differentiate them I can add it in.


#202

Just looking at the TiVo TCP guide.

The only thing I could suggest would be to send a ‘SETCH’ command just after you get a disconnect. If the box is on but just not in live mode it should return ‘CH_FAILED NO_LIVE’. If the box is truly off then you should get nothing back.

Could cause funky behaviour if the box actually responds and changes the channel though.