@Rich_Paul - hope you don’t mind another question from someone new to all of this. I’ve read through the comments and don’t think my question has came up.
I’ve been able to manually send commands via command line on my personal windows laptop and can turn the tivo box on and off etc. But I’ve not been able to do this via my pi with homeassist installed.
I’ve added the SSH component and been able to log in but I think my command isn’t getting out of the raspberry PI. I’m using hassio - which means I’m kind of restricted (I can’t install telnet or equivalents - so I’ve been trying to use CURL instead).
I suspect the 31337 port isn’t bound to the host from the container that it runs under. Is there any configuration I need to do?
Or is the alternative to wipe the PI, start afresh, install linux and then put homeassist on top myself without doing the whole hassio/image thing?
All thoughts and recommendations greatly appreciated.
Why don’t you use @Bertbert custom component? I don’t use my cmd line scripts now as it didn’t always work and I couldn’t report the state.
Im on hassbian which gives me more control but I think you can get sudo permissions on hassio, I’ve definitely read it somewhere. I’m assuming you can’t install telnet without sudo so Google how to get sudo and try again perhaps?
@rich_paul - cheers for pointing me in the right direction - got it up and running - it works really well.
@Bertbert - thanks for producing and sharing the component. I can’t believe just how well it works - it’s really smart! I do have one question, is it possible to turn on the Virgin box? I can switch it off, change channel etc … but I can’t seem to switch it on when its off … am I doing something daft? I’m getting an error in the logs
2019-03-15 11:55:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1875211664] [Errno 9] Bad file descriptor
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 148, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1133, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1155, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py”, line 188, in handle_service
self._platforms.values(), func, call, service_name
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 278, in entity_service_call
future.result() # pop exception if have
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 292, in _handle_service_platform_call
await getattr(entity, func)(**data)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/media_player/virgintivo.py”, line 862, in turn_off
self.tivo_cmd(cmd)
File “/config/custom_components/media_player/virgintivo.py”, line 503, in tivo_cmd
self._sock.sendall(upper_cmd.encode())
OSError: [Errno 9] Bad file descriptor
Everything else works like a treat, so I’m assuming I’ve done something silly. Any help would be appreciated. (On latest version of hassio 0.89 I think) - and the latest version of your script. I’m using the “minimal example” yaml from your readme.mid.
So - how about for user who are configured to use the external provider for the channel list, allow the local .yaml file to contain overrides.
Then I could remove everything from the local .yaml except for temporary overrides.
Reasonably sure I had this working before. I’ll need to relook at it at some point. It was never very clean since the box doesn’t give any response on the command line when it is off. It performs exactly the same when it is playing anything other than live TV (playing a recording, using an app etc). So I can’t be sure of the state of the box unless I can see it is on.
Regarding “override:” … thanks - I should have spotted that.
It works well.
I now have some editing rights on the channel source list. Would you like a comment added to indicate that your script is processing the table to highlight that future changes to the table format (if there were to be any) might have unexpected consequences?
Also … what would be the recommended solution for the current set-up of channel 101 for England?
At tvchannellists they have split cell 0 to have 2 different channel numbers - one for Sco/Wal/NI and the other for Eng.
101 in England is “BBC One” not “BBC One HD”.
I can put an override for 101 but the override section does not support “hd_channel” so I cannot get it to switch to the HD version on 108 (which is “BBC Scotland HD” for Scotland).
Perhaps “override” section should also support hd_channel.
Household knows to go to 101 for BBC One and I used to have it switch to 108 via “channels” section.
Edit:
Perhaps keep it even simpler and make the schema for “override” the same as for regular channels. This would then make it easier to copy/paste from the old channel list for those that have one and might make it possible to re-use some code.
It should work automatically if you get the overrides correct. In the overrides, define 101 as BBC One and 108 as BBC One HD. If everything is working as I intended, behind the scenes it will set hd_channel for 101 to be 108.
If it’s not doing that, let me know along with your overrides section. I can’t test with those specific channels because I don’t have 108, but I tried it with others.
enable: True
override:
101:
name: BBC One
package: Free-to-air
is_hd: False
104:
name: Channel 4 HD
package: Free-to-air
is_hd: True
108:
name: BBC One HD
package: Free-to-air
is_hd: True
Lower down I also have them in the “channels” section
channels:
100:
name: Virgin Media Previews
package: Mix
101:
name: BBC One
show: true
package: Free-to-air
hd_channel: 108
102:
name: BBC Two HD
show: true
package: Free-to-air
103:
name: ITV
show: true
package: Free-to-air
hd_channel: 113
plus_one: 114
104:
name: Channel 4 HD
show: true
package: Free-to-air
plus_one: 142
105:
name: Channel 5
show: true
package: Free-to-air
hd_channel: 150
plus_one: 155
106:
name: E4
show: true
package: Player
hd_channel: 145
plus_one: 146
107:
name: BBC Four
package: Free-to-air
hd_channel: 163
108:
name: BBC One HD
package: Free-to-air
show: true
From the docs …
NB: If both tvchannellists and channels are configured, the site will be tried first and if this fails the local channel configuration will be used.
For the parsing of the web page on tvchannellists.com … I haven’t put any debug tracing in yet - but I wonder if the parsing has problems with the split rows … and 101 appearing twice with one flagged as HDTV and the other as SDTV.
<tr>
<td>101 <small>(Scot, Wales, NI)</small></td>
<td rowspan=“2”>BBC One HD</td>
<td rowspan=“2”>4 national variations. BBC iPlayer via the red button.</td>
<td rowspan=“2”>BBC</td>
<td rowspan=“2”>24 hours</td>
<td rowspan=“2” bgcolor=“Lime”>Player</td>
<td rowspan=“2” bgcolor=“lightgray”>1080i HDTV</td>
<td rowspan=“2”>2.0 PLII Digital / 5.1 AC3 Digital</td>
<td rowspan=“2”>2010/11/03
</td></tr>
<tr>
<td>108 <small>(Eng)</small>
</td></tr>
<tr>
<td>101 <small>(Eng)</small></td>
<td>BBC One [English region]</td>
<td>15 English regional variations; see also channels 851 and 861 (BBC One London). National versions of BBC One are on 862-864. BBC iPlayer via the red button.</td>
<td>BBC</td>
<td>24 hours</td>
<td bgcolor=“tan”>Free-to-air</td>
<td>16:9 SDTV</td>
<td>2.0 Stereo</td>
<td>2007/02/08
</td></tr>
The bit in the docs means that it is only if it can’t get any channels from the site (i.e. it is down or the table structure has been altered so much it can’t be used) that it will use the local channels.
It should be fairly tolerant of most changes and doesn’t care too much about split entries. It’ll use the first of those.
Thanks, but it’s not really for them to worry about what someone else is scraping their site for. It’s really up to me to mirror any changes there. Hopefully they won’t make wholesale changes very often, although I do note that they don’t have a standard across the various listings.
Fix checked in for the problem with turning the box on from an off state. Hopefully that will work for you.
Also fixed a problem where the channel listings weren’t appearing for BBC One HD. Did a bit of tidying up on how that works while I was in there. Bound to have introduced some new bug
Before I put in the new script I noticed that there was an informational log entry …
2019-03-19 10:06:32 WARNING (MainThread) [homeassistant.loader] Integrations need to be in their own folder. Change media_player/virgintivo.py to virgintivo/media_player.py. This will stop working soon.
So when I moved to the latest version of the script I deleted the media_player/virgintive.py file and folder and created a virgintivo folder and renamed the python script to media_player.py.
It all worked perfectly and I no longer get that info message … if you agree that its the correct thing to do, perhaps we could update the getting started comments in the readme.mid?
I’m looking to send a service call to change to a specific channel, triggered by a google assistant command in IFTTT. All I have left to figure out is to send the service call from home assistant. Could you advise what I am doing wrong please? Just need an example of how to invoke a SETCH command - and how to ensure I send to the right tivo box when I have two set up.