Control TiVo box over telnet


#61

Ok @Rich_Paul so to add it to my HA I simply add the above code to the configuration.yaml file ?

Sorry like I said I’m very new to this. once I get a basic understanding of the product I will manage to find my way through this


#62

Not a problem matey.

Restart your virgin box by switching it off at the plug - i have just done this and mines working again.

switch virgin_off:   platform: command_line   switches:     virgin_off:       command_on: 'echo IRCODE STANDBY | telnet 192.168.0.10 31339'       command_off: 'echo IRCODE STANDBY | telnet 192.168.0.10 31339'       friendly_name: Virgin off

whack that straight into your configuration.yaml file… replace the ip with your box.

restart home assistant and you’re good to go…

sudo systemctl restart [email protected]

i have edited the switch above so it is indented correctly as the previous one was not - try this updated one and let me know how you get on…


#63

Why do I have a feeling this is me causing the problem

So I have copied the above into the configuration (see the below) but now HA doesn’t even start up. I have copied the error that comes up into below also

Amazon Echo example configuration.yaml entry

emulated_hue:
type: alexa
listen_port: 80

switch virgin_off:
platform: command_line
switches:
virgin_off:
command_on: 'echo IRCODE STANDBY | telnet 192.168.0.18 31339’
command_off: 'echo IRCODE STANDBY | telnet 192.168.0.18 31339’
friendly_name: Virgin off

AND THE ERROR

ERROR homeassistant.bootstrap:Error loading .\homeassistant\configuration.yaml ‘utf-8’ codec cant decode byte 0xa0 in position 1382: invalid start byte

Once I remove the virgin entry it fires up fine


#64

Ignore the first part @Rich_Paul I moved the text to the middle of the file and it now opens up

However when home assistant opens I have this error

Invalid config
The following components and platforms could not be set up:
switches
command_off
friendly_name
virgin_off
command_on
platform
Please check your config
DISMISS

Do you have an email address or something maybe so I can stop attaching all on here and send to you directly to look at


#65

Its because all of your config starts at the same line which is wrong.

It needs to look EXACTLY like the below containg no TABS:
0 spaces on line 1
2 spaces on line 2 and 3
4 spaces on line 4
6 spaces on the rest

switch virgin_off:   platform: command_line   switches:     virgin_off:       command_on: 'echo IRCODE STANDBY | telnet 192.168.0.10 31339'       command_off: 'echo IRCODE STANDBY | telnet 192.168.0.10 31339'       friendly_name: Virgin off

#66

It was the copy and pasting that was causing the issues, even when I copied and pasted into Notepad ++ the spacing were in but didn’t group it together

So now we are close but still no cigar. I’m my HA app I can now see Switch with a Virgin off option and a blue and black lightening bolt, but when I click them nothing is happening on my box. I have changed the ip address to match my box and have confirmed it by telnets and testing the IRCODE STANDBY.

I have restarted both the TiVo box and the HA and the issue is still the same


#67

try turning your virgin box on n off by plug again. Dont start any telnet sessions after youve done that


#68

I just signed up to say - I LOVE THIS THREAD!! I’ve only just started playing with Home Assistant and I kinda stumbled across this thread looking for ideas - and I now have a fully voice controlled Virgin Tivo box through Alexa which my family love!

It took some some doing, but basically I programmed every single channel into HA as a switch with the SETCH code from the above posts - I couldn’t get my Echo to recognise emulated hue from HA, so I’ve had to use Hasska, but it’s worked a treat and I’ve not had a single issue with it.

I just give Alexa the command ‘Turn on channel name’ and she does it, no problem - the only note I have is that I’ve had to slightly adjust a couple of my friendly names so that Alexa will recognise it - for example; E4 HD has had to become E Four HD on HA, but we’re talking maybe 5 adjustments out of 300 channels - so not major.

Thanks a lot for your help and to @Rich_Paul Rich_Paul for digging up the original codes/posts.

FYI - I’ll post my yaml files for my switches somewhere if people are interested to save you writing them all out - just let me know if you want (you’ll just need to replace my IP for yours)?


#69

Still the same I’m afraid @Rich_Paul. I have added a 2nd switch to try turn to channel one to see if that did anything but its the same as the Stand By. Appears in HA and says it is doing it in HA but no response from the Tivo box


#70

Its good to hear a success story @Wishywash. I’m desperately struggling for some reason at the moment. The Yaml file looks good and HA sees it all but my Virgin box doesn’t respond. Yet via telnet the cmd lines are all good


#71

Sorry to hear that @Paul_Duggins - have you definitely installed the telnet client in Python? The commands won’t execute if you haven’t?

The command you need is - pip3 install telnetlib3


#72

Thanks alot @Wishywash!

I also have some strange Alexa groups - " Eye Tee Vee"… Settles for “Three” now ha ha


#73

prob need sudo to do that:
sudo pip3 install telnetlib3

Its working on his cmd line though, im sure it should just work in HA now… What does the log say @Paul_Duggins?


#74

try a sudo reboot


#75

that makes sense though - Telnet is native to cmd/windows - but it’s not to Python - HA runs in the Python environment - so he still needs to install the client for HA to work with them.


#76

@Rich_Paul and @Wishywash

Appreciate all you help

Just so you guys have an idea of the environment

I’m not using a Raspberry Pi , At the moment using a Windows 10 laptop with Python and HA install on that

I believed I had installed the telnet client before but have just ran it again from a command line and got the following

C:\Users\Test>pip3 install telnetlib3
Collecting telnetlib3
Downloading telnetlib3-0.5.0-py3-none-any.whl (101kB)
100% |████████████████████████████████| 102kB 741kB/s
Collecting wcwidth (from telnetlib3)
Downloading wcwidth-0.1.7-py2.py3-none-any.whl
Collecting asyncio (from telnetlib3)
Downloading asyncio-3.4.3-py3-none-any.whl (101kB)
100% |████████████████████████████████| 102kB 2.2MB/s
Installing collected packages: wcwidth, asyncio, telnetlib3
Successfully installed asyncio-3.4.3 telnetlib3-0.5.0 wcwidth-0.1.7

I have again restarted the HA (But not the Tivo again) and have tried it again with no success


#77

have you rebooted your python to ensure the telnet has started?


#78

@Wishywash

I have rebooted the Laptop so

So maybe I am just doing something stupid

This is the process i am following

Laptop Turned On
Batch file on desktop that runs hass --open-ui to Start HA
I don’t have anything else running

HA loads up and all of the Components for the Virgin are there (I have set up BBC and Virgin Off) doesn’t matter if I click any of them nothing happens

For additional Info I do have my Philips Hue components set up also and this is working fine (I assume this uses python to do what it needs to do also)

As I mentioned before I am new to python / HA and all this type of thing so I’m learning as I go along I’m afraid


#79

ok - have you looked at your home-assistant.log? - this is usually pretty good at pointing you in right direction if HA is getting errors.

The only other thing I think of is if you share your config with us so we can check it over for conflicts for you - I’ve set up an empty dropbox you can upload it too if you wish, but as this is public -
remove anything personal before sharing https://www.dropbox.com/sh/uuz7vyrmw335tih/AAAURaHBvckp1ijMm6gDFfuVa?dl=0oi


#80

I have also take a look in the log and it is copied below

17-04-26 21:45:05 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=37 from 2017-04-26 20:36:23.585127)
17-04-26 21:45:30 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x000001FB4CFA7E80>_3) [plexapi] http://192.168.0.30: (404) not_found
17-04-26 21:45:40 WARNING (MainThread) [homeassistant.components.media_player] Setup of platform plex is taking over 10 seconds.
17-04-26 21:45:51 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x000001FB4CFA7E80>_4) [plexapi] http://xxxxxx: HTTPConnectionPool(host=‘xxxxxx’, port=80): Max retries exceeded with url: / (Caused by NewConnectionError(’<requests.packages.urllib3.connection.HTTPConnection object at 0x000001FB4ED0EE10>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond’,))