Tivo 1.1 Protocol - NEW Binding Contribution!

The following code can be used in conjunction with the HabPanel and this binding to create a Search “widget” for the TiVo platform:

The rule simply uses the appropriate commands to navigate to the integrated search pages on the TiVo. In the case of Virgin Media TiVo devices this is accessed by sending the:

  1. TIVO (Home) TELEPORT command

  2. Sending the remote control key press IRCODE number 4 (quick way to navigate TiVo menu items).

  3. Each keystroke for characters A-Z, number 0-9 and space are then sent as individual keystrokes (KEYBOARD).

The menu structure of other TiVo devices may differ, so you may need to amend the initial commands to navigate to the search page on your specific device / menu implementation.

Within the rule are a series of sleep commands Thread::sleep(300), these are added to allow the menu system to complete execution of the command before the next command is set. You may need to tweak these numbers depending on the performance of your device.

Rule code:

// Rules
rule "Search"
when
    Item TiVo_KeyboardStr received command
then
	logInfo("tivo.search","Script started ")
	if (TiVo_KeyboardStr.state != NULL && TiVo_KeyboardStr.state.toString.length > 0) {
		
		// Commands to get us to the Tivo/Home menu and select the search menu using the 'remote'
		// number keys
		sendCommand(TiVo_MenuScreen, "TIVO")
		Thread::sleep(800)
		sendCommand(TiVo_KbdCmd, "NUM4")
		Thread::sleep(800)
		
		var i = 0
		var l = 0
		var char txt = ""
		var srch = TiVo_KeyboardStr.state.toString.toUpperCase
		logInfo("tivo.search"," Searching for: " + srch)
		logDebug("tivo.search"," Search length: " + srch.length)

		while (i < (srch.length)) {
			logDebug("tivo.search"," Loop i=: " + i)
			txt = srch.charAt(i)
			logDebug("tivo.search"," txt: " + txt.toString)
			if (txt.toString.matches("[A-Z]")) {
				// Check for upper case A-Z
				sendCommand(TiVo_KbdCmd, txt.toString)
			} else if (txt.toString.matches(" ")) {
				// Check for Space
				sendCommand(TiVo_KbdCmd, "SPACE")
			} else if (txt.toString.matches("[0-9]")) {
				// Check for numbers 0-9
				l = 0
				switch txt.toString {
					case "1":
						sendCommand(TiVo_KbdCmd, "NUM1")
					case "7": {
						sendCommand(TiVo_KbdCmd, "NUM7*5")
						}
					case "9": {
						sendCommand(TiVo_KbdCmd, "NUM9*5")
						}
					default: {
						sendCommand(TiVo_KbdCmd, "NUM" + txt.toString + "*4")
						}
				}
			} else {
				logWarn("tivo.search"," Character not supported by script: " + txt)
			}
			i = i + 1
		}
	}
	lock.unlock()
end

Items:

String 		TiVo_ChangeScreen		"Screens" 			{channel="tivo:sckt:Living_Room:tivoTeleport", autoupdate="false"}
String 		TiVo_IRCmd				"Ir Cmd" 		    {channel="tivo:sckt:Living_Room:tivoIRCommand", autoupdate="false"}
String 		TiVo_KbdCmd				"Keyboard Cmd"   	{channel="tivo:sckt:Living_Room:tivoKBDCommand", autoupdate="false"}

String 		TiVo_KeyboardStr		"Search String"

HABpanel template widget HTML:

  <div class="form-group">
    <div class="col-xs-9">
       <input type="text" class="form-control" style="color: black" no-snap-drag="true" ng-model="myvalue" name="searchStr" required ng-trim="true">
    </div>
    <div class="col-xs-2">
      <button class="btn btn-primary" ng-click="sendCmd('TiVo_KeyboardStr', myvalue)">
		  Search
	   </button>
     </div>
  </div>

TESTERS WANTED!

I could really do with some feedback from other TiVo users out there…

  1. I really need confirmation that this works TiVo boxes based outside the UK i.e. non Virgin Media branded devices
  2. I need confirmation that all is OK if you have more than one TiVo device.

Thanks in anticipation!

Changes since last time:

  • Streamlined code
  • Now detects Online / Online (Standby) / Offline state of device
  • Tweaked logging to add and remove some of the logged entries.
  • Debug logging is still very verbose and is not recommended for long periods!
  • README.md is available on the GitHUB link which should help setup / understand the binding settings etc.

Latest version of the code can be downloaded from here:
org.openhab.binding.tivo_2.1.0-SNAPSHOT.jar

and viewed on GitHub here:
https://github.com/AndyXMB/openhab2-addons/tree/tivo/addons/binding/org.openhab.binding.tivo

Latest download:
org.openhab.binding.tivo_2.1.0-SNAPSHOT.jar

Changes:

  • Reduced error logging when a TiVo is offline.
  • Ability to send multiple keyboard commands by appending *n where n is the number of repeats e.g. NUM2*4 will send the number 2 keystoke 4 times.

I’ve updated the code in this post Search “widget” for the TiVo platform to use the latter enhancement.

The ability to send the same keystroke makes it possible to search for numbered items. Pressing the 2 key 4 times in rapid succession cycles through the characters A, B, C, 2, providing the desired numeric search character etc.

As always, any feedback would be great.

Regards, Andy

Latest version of my panel implementation using this binding.

The following rule code allows the translation of the channel number to channel name:

rule "MapChannel"
when
    Item TiVo_SetPoint changed
then
	var chName = ""
	chName = transform("MAP", "tivo.map", TiVo_SetPoint.state.toString)
	postUpdate(TiVo_SetPointName, chName)

end

Using a simple tivo.map file:

NULL=Unknown
100=Virgin Media Previews
101=BBC One
102=BBC Two
103=ITV

etc...

The latest code for the ‘multimedia custom template’ widget is:

<style>
	.tivobutton {width: 100%; height: 4em; border: 0; color: white; background: #424242;}
	.modgrid {padding-left: 2px; padding-right: 2px; padding-top: 2px; padding-bottom: 2px;}
	.butticon {font-size:2em;}
</style>
<div id="tivo-mediaplay"  class="table" ng-show="!showActions" ng-swipe-left="showActions = true">
	<div class="row">
		<div class="col-xs-4 modgrid">
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'PLAY')">
				<i class="glyphicon glyphicon-play butticon" alt="Play"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
		</div>
	</div>
	<div  class="row">
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'REVERSE')">
				<i class="glyphicon glyphicon-backward butticon" alt="Backward"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button style="background: #FFCC00; color:black" class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'PAUSE')">
				<i class="glyphicon glyphicon-pause butticon" alt="Pause"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'FORWARD')">
				<i class="glyphicon glyphicon-forward butticon" alt="Forward"></i>
			</button>
		</div>
	</div>
	<div  class="row">
		<div class="col-xs-4 modgrid">
		<button class="tivobutton" style="background: #666666; color:black;" ng-click="sendCmd('TiVo_IRCmd', 'REPLAY')">
				<i class="glyphicon glyphicon-step-backward butticon" alt="Step Backward"></i>
			</button>
		</div>	
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'STOP')">
				<i class="glyphicon glyphicon-stop butticon" alt="Stop"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" style="background: #666666; color:black;" ng-click="sendCmd('TiVo_IRCmd', 'ADVANCE')">
				<i class="glyphicon glyphicon-step-forward butticon" alt="Step Forward"></i>
			</button>
		</div>
	</div>
	<div  class="row" style="padding-top: 18px">
		<div class="col-xs-12">
			<button  style="width: 2em; height: 2em; border: 0; color: white; background: #0db9f0" ng-click="showActions = false">
			1
			</button>
			  
			<button style="width: 2em; height: 2em; border: 0; color: white; background: #666666" ng-click="showActions = true">
			2
			</button>
		</div>
	</div>
</div>

<div id="tivo-mediaplay"  class="table"  ng-show="showActions" ng-swipe-left="showActions = false">
	<div  class="row">
		<div class="col-xs-4 modgrid">
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'UP')">
				<i class="glyphicon glyphicon-triangle-top butticon" alt="Up"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" style="background: #666666" ng-click="sendCmd('TiVo_IRCmd', 'CHANNELUP')">	
        Page<br>Up			
</button>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'LEFT')">
				<i class="glyphicon  glyphicon-triangle-left butticon" alt="Left"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" style="background: #666666" ng-click="sendCmd('TiVo_IRCmd', 'SELECT')">
				OK
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'RIGHT')">
				<i class="glyphicon  glyphicon-triangle-right butticon" alt="Right"></i>
			</button>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-4 modgrid">
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" ng-click="sendCmd('TiVo_IRCmd', 'DOWN')">
				<i class="glyphicon  glyphicon-triangle-bottom butticon" alt="Down"></i>
			</button>
		</div>
		<div class="col-xs-4 modgrid">
			<button class="tivobutton" style="background: #666666" ng-click="sendCmd('TiVo_IRCmd', 'CHANNELDOWN')">
        Page<br>Down  			
</button>
		</div>
	</div>
		<div class="row"style="padding-top: 18px">
		<div class="col-xs-12">
			<button  style="width: 2em; height: 2em; border: 0; color: white; background: #666666" ng-click="showActions = false">
			1
			</button>
			  
			<button style="width: 2em; height: 2em; border: 0; color: white; background: #0db9f0" ng-click="showActions = true">
			2
			</button>
		</div>
	</div>
</div>

Again hope this is useful to someone out there… :slight_smile:

Andy

2 Likes

Thanks for the contribution @AndyMB. I’ve been using this binding successfully for months now. I have a Tivo Bolt bought and used within the US.

Thanks @jahubba,

LAST CALL for any user feedback on this one before I work out how to raise a PR for this binding. If you have been testing the latest .jar file and have any feedback, positive or negative NOW IS THE TIME.

Especially keen to hear from anyone out there who has more than one box working (as I only have the one).

Cheers, Andy

Andy - can you give me a couple tips on how to implement the files for your Tivo control? I’m not 100% sure what I need to install and where these go? I have Tivo working properly using sitemaps, across two Tivos.

Hi @alfista2600,

Check out this thread in the HABpanel section of the forums:

You will also find all the help you should need to get your HABpanel installation started, if you have not done this already here:

If you are still stuck, then please post either in this thread or the original menu / navigation one. If you can provide as much detail as possible of where you have managed to get to i.e. screenshots, what is working and what is not and copy the items that you have created for the Tivos from your items file. This makes it much easier to help etc.

Thanks for confirming you have two TiVos working with sitemaps. That is great to hear :smiley:

Regards, Andrew

Hi All,

I’ve raised the PR https://github.com/openhab/openhab2-addons/pull/2312 to promote the code. Fingers crossed I have not made any significant errors :wink:

I’m having trouble with the sign off process, so if anyone can spot what I am doing wrong, let me know.

Regards, Andy

Hi

Has anyone configured this binding manually using a .things file and if so, could you share an example.

Thanks

@Mark_Webster Mark,

See https://github.com/AndyXMB/openhab2-addons/tree/master/addons/binding/org.openhab.binding.tivo

The readme,md should hopefully answer your question. If not then let me know, so that I can improve the content. If I get this as clear as possible, should save support queries in the future etc.

Regards, Andy

Hi…

I’ve got the binding working pretty well now… Just got one question… Is it possible to configure the binding to execute the Channel Scan on a schedule to ensure the channels to ignore is kept upto date?

I’d like to be able to schedule this to execute on a monthly basis, say 3am on 1st of each month?

I’m trying to get this going with openhabian under 2.2.0 - anyone have any tips/best practices?

I’m guessing this is a dead topic since it’s been over a year since any updates, and longer since the githab repo was touched, but is anyone else using this? I’ve had it working without trouble for ages, and haven’t changed anything recently, but it has stoped working. Every attempt to change channel gives me [WARN ] [hab.binding.tivo.handler.TiVoHandler] - TiVo'tivo:sckt:316abe31' set channel command failed 'SETCH 507' with msg 'CH_FAILED NO_LIVE'
My OpenHAB is on 2.4, as nothing else was broken so I haven’t updated recently.

misha, the SETCH function only works when you’re in LIVE TV mode. From the TiVo 1.1 Protocol spec:

CH_FAILED NO_LIVE
The SETCH command failed because the UI was not in Live TV mode at the
time the command was issued

I’m aware, but I’m getting the error despite being in LIVE TV mode. I even added a step of specifically setting the mode before the SETCH command, and still got NO_LIVE. It’s not due to anything wrong with the binding, as I’ve reproduced the errors using direct TCP commands. At any rate, I switched to using IRCODE and the numbers I want, and also switched to just using Node Red to send the TCP commands, since that’s ultimately where I need the interface anyway. Key was figuring out that you can string multiple IRCODE commands together in a single TCP request.