@jahubba, really sorry I missed your request. This is quite complicated, but here goesā¦
Here is the JSON for the TiVo panel (requires a 6 column grid set-up). Study the JSON structure and take care when you are pasting into the advanced editor and take suitable backups etc. Learn from MY mistakes
Dohā¦ brain failure, easier to use the link below to download and import etc. This is the single panel for Tivo.
Exported HabPannel
and a download of the location.rules:
location.rules
{
"id": "Multimedia",
"name": "Tivo",
"widgets": [
{
"name": "My Shows",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 9,
"col": 6,
"command": "NOWSHOWING",
"background": "#666666",
"background_active": "#666666"
},
{
"name": "Tivo Status",
"sizeX": 10,
"sizeY": 2,
"item": "TiVo_Command_Result",
"type": "dummy",
"row": 1,
"col": 0,
"iconset": "freepik-household",
"icon": "television-2",
"icon_size": 32,
"icon_nolinebreak": true
},
{
"name": "TV Power",
"sizeX": 2,
"sizeY": 2,
"item": "Power1_GF_Living",
"type": "switch",
"row": 1,
"col": 10,
"iconset": "freepik-housethings",
"icon": "electric-socket",
"icon_size": 32
},
{
"name": "Home",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 9,
"col": 4,
"command": "TIVO",
"background": "#666666",
"background_active": "#666666"
},
{
"name": "Window",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 9,
"col": 10,
"command": "WINDOW",
"background": "#666666",
"background_active": "#666666"
},
{
"name": "Volume",
"sizeX": 2,
"sizeY": 6,
"item": "SaTV_Volume",
"type": "slider",
"row": 3,
"col": 0,
"vertical": true,
"floor": 0,
"ceil": 25,
"step": 1
},
{
"name": "TV",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 9,
"col": 2,
"command": "TV",
"background": "#666666",
"background_active": "#666666"
},
{
"name": "Guide",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 9,
"col": 8,
"command": "GUIDE",
"background": "#666666",
"background_active": "#666666"
},
{
"name": "Mute",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 9,
"col": 0,
"command": "MUTE",
"background": "#666666",
"background_active": "#666666"
},
{
"name": "Lamp",
"sizeX": 2,
"sizeY": 2,
"item": "Power2_GF_Living",
"type": "switch",
"row": 11,
"col": 0,
"hidelabel": false,
"iconset": "freepik-household",
"icon": "lamp-5",
"icon_size": 32
},
{
"name": "BBC 1 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 14,
"col": 0,
"command": "SETCH 108",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "Auto Pause",
"sizeX": 2,
"sizeY": 2,
"item": "Tivo_AutoPause",
"type": "switch",
"row": 3,
"col": 10,
"hideicon": true
},
{
"name": "CH4 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 14,
"col": 6,
"command": "SETCH 142",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "SyFi",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 15,
"col": 2,
"command": "SETCH 135",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "Film4 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 15,
"col": 10,
"command": "SETCH 429",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "Sky 1",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 15,
"col": 0,
"command": "SETCH 110",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "Channel",
"sizeX": 2,
"sizeY": 6,
"item": null,
"type": "template",
"row": 3,
"col": 8,
"template": "<button style=\"width: 100%; height: 100%;\nborder: 0; color: white; background: #FFCC00;\nfont-size: 30px\" ng-click=\"sendCmd('TiVo_SetPoint', (itemValue('TiVo_SetPoint')-0+1))\">\n<i class=\"glyphicon glyphicon-menu-up\"></i>\n</button>\n\n<p>Channel<br/>\n{{itemValue('TiVo_SetPoint')}}</p>\n\n<button style=\"width: 100%; height: 100%;\nborder: 0; color: white; background: #FFCC00;\nfont-size: 30px\" ng-click=\"sendCmd('TiVo_SetPoint', (0 + itemValue('TiVo_SetPoint')-1))\">\n<i class=\"glyphicon glyphicon-menu-down\"></i>\n</button>"
},
{
"name": "New Widget",
"sizeX": 2,
"sizeY": 2,
"item": null,
"type": "template",
"row": 5,
"col": 10,
"template": "<div ng-if=\"itemValue('Tivo_PlayPause')==1\">\n <button class=\"btn btn-dg\" style=\"width: 100%; height: 100%\"\n ng-click=\"sendCmd('Tivo_PlayPause', 2)\">\n <small>Pause</small>\n </button>\n</div>\n\n<div ng-if=\"itemValue('Tivo_PlayPause')==2\">\n <button class=\"btn btn-dg\" style=\"width: 100%; height: 100%\"\n ng-click=\"sendCmd('Tivo_PlayPause', 1)\">\n <small>Play</small>\n </button>\n</div>"
},
{
"name": "BBC R1",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 16,
"col": 0,
"command": "SETCH 901",
"background": "transparent",
"background_active": "transparent"
},
{
"name": "BBC R2",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 16,
"col": 2,
"command": "SETCH 902",
"background": "transparent",
"background_active": "transparent"
},
{
"name": "BBC R4",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 16,
"col": 4,
"command": "SETCH 904",
"background": "transparent",
"background_active": "transparent"
},
{
"name": "E4",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 15,
"col": 4,
"command": "SETCH 144",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "Absolute 80s",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 16,
"col": 6,
"command": "SETCH 951",
"background": "transparent",
"background_active": "transparent"
},
{
"name": "Classic FM",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 16,
"col": 8,
"command": "SETCH 922",
"background": "transparent",
"background_active": "transparent"
},
{
"name": "Favourites",
"sizeX": 12,
"sizeY": 1,
"item": null,
"type": "label",
"row": 13,
"col": 0,
"background": "#999999"
},
{
"name": "Tivo",
"sizeX": 12,
"sizeY": 1,
"item": null,
"type": "label",
"row": 0,
"col": 0,
"background": "#999999"
},
{
"name": "BBC 2 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 14,
"col": 2,
"command": "SETCH 162",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "ITV 1 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 14,
"col": 4,
"command": "SETCH 113",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "CH 5 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 14,
"col": 8,
"command": "SETCH 150",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "BBC 4 HD",
"sizeX": 2,
"sizeY": 1,
"item": "TiVo_Fav_Channel",
"type": "button",
"row": 14,
"col": 10,
"command": "SETCH 163",
"background": "#0099CC",
"background_active": "#0099CC"
},
{
"name": "Standby",
"sizeX": 2,
"sizeY": 2,
"item": "TiVo_IRCmd",
"type": "button",
"row": 7,
"col": 10,
"command": "STANDBY",
"iconset": "smarthome-set",
"icon": "power-button",
"icon_size": 32
},
{
"name": "TivoControl",
"sizeX": 6,
"sizeY": 6,
"item": null,
"type": "template",
"row": 3,
"col": 2,
"template": "<style>\n\t.tivobutton {width: 100%; height: 4em; border: 0; color: white; background: #424242;}\n\t.modgrid {padding-left: 2px; padding-right: 2px; padding-top: 2px; padding-bottom: 2px;}\n\t.butticon {font-size:2em;}\n</style>\n<div id=\"tivo-mediaplay\" class=\"table\" ng-show=\"!showActions\" ng-swipe-left=\"showActions = true\">\n\t<div class=\"row\">\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'PLAY')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-play butticon\" alt=\"Play\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t</div>\n\t</div>\n\t<div class=\"row\">\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'REVERSE')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-backward butticon\" alt=\"Backward\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button style=\"background: #FFCC00; color:black\" class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'PAUSE')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-pause butticon\" alt=\"Pause\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'FORWARD')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-forward butticon\" alt=\"Forward\"></i>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class=\"row\">\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t<button class=\"tivobutton\" style=\"background: #666666; color:black;\" ng-click=\"sendCmd('TiVo_IRCmd', 'REPLAY')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-step-backward butticon\" alt=\"Step Backward\"></i>\n\t\t\t</button>\n\t\t</div>\t\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'STOP')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-stop butticon\" alt=\"Stop\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" style=\"background: #666666; color:black;\" ng-click=\"sendCmd('TiVo_IRCmd', 'ADVANCE')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-step-forward butticon\" alt=\"Step Forward\"></i>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class=\"row\" style=\"padding-top: 18px\">\n\t\t<div class=\"col-xs-12\">\n\t\t\t<button style=\"width: 2em; height: 2em; border: 0; color: white; background: #0db9f0\" ng-click=\"showActions = false\">\n\t\t\t1\n\t\t\t</button>\n\t\t\t \n\t\t\t<button style=\"width: 2em; height: 2em; border: 0; color: white; background: #666666\" ng-click=\"showActions = true\">\n\t\t\t2\n\t\t\t</button>\n\t\t</div>\n\t</div>\n</div>\n\n<div id=\"tivo-mediaplay\" class=\"table\" ng-show=\"showActions\" ng-swipe-left=\"showActions = false\">\n\t<div class=\"row\">\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'UP')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-triangle-top butticon\" alt=\"Up\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t</div>\n\t</div>\n\t<div class=\"row\">\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'LEFT')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-triangle-left butticon\" alt=\"Left\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" style=\"background: #666666\" ng-click=\"sendCmd('TiVo_IRCmd', 'SELECT')\">\n\t\t\t\tOK\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'RIGHT')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-triangle-right butticon\" alt=\"Right\"></i>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class=\"row\">\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t\t<button class=\"tivobutton\" ng-click=\"sendCmd('TiVo_IRCmd', 'DOWN')\">\n\t\t\t\t<i class=\"glyphicon glyphicon-triangle-bottom butticon\" alt=\"Down\"></i>\n\t\t\t</button>\n\t\t</div>\n\t\t<div class=\"col-xs-4 modgrid\">\n\t\t</div>\n\t</div>\n\t\t<div class=\"row\"style=\"padding-top: 18px\">\n\t\t<div class=\"col-xs-12\">\n\t\t\t<button style=\"width: 2em; height: 2em; border: 0; color: white; background: #666666\" ng-click=\"showActions = false\">\n\t\t\t1\n\t\t\t</button>\n\t\t\t \n\t\t\t<button style=\"width: 2em; height: 2em; border: 0; color: white; background: #0db9f0\" ng-click=\"showActions = true\">\n\t\t\t2\n\t\t\t</button>\n\t\t</div>\n\t</div>\n</div>",
"dontwrap": false,
"nobackground": true
},
{
"name": "Bookshelf",
"sizeX": 2,
"sizeY": 2,
"item": "EG4_Switch_1_1",
"type": "switch",
"hidelabel": false,
"iconset": "freepik-household",
"icon": "lights",
"icon_size": 32,
"row": 11,
"col": 2
},
{
"name": "Jongo",
"sizeX": 2,
"sizeY": 2,
"item": "VOB_Jongo",
"type": "switch",
"hidelabel": false,
"iconset": "freepik-gadgets",
"icon": "audio-speaker",
"icon_size": 32,
"row": 11,
"col": 4
},
{
"name": "Vegas",
"sizeX": 2,
"sizeY": 2,
"item": "EG4_Switch_1_3",
"type": "switch",
"hidelabel": false,
"iconset": "freepik-household",
"icon": "light-bulb-2",
"icon_size": 32,
"row": 11,
"col": 6
},
{
"name": "Pinball TVs",
"sizeX": 2,
"sizeY": 2,
"item": "VOB_VirtualPinball",
"type": "switch",
"hidelabel": false,
"iconset": "freepik-gadgets",
"icon": "computer-monitor",
"icon_size": 32,
"row": 11,
"col": 8
},
{
"name": "Pinball PC",
"sizeX": 2,
"sizeY": 2,
"item": "EG4_Switch_2_1",
"type": "switch",
"hidelabel": false,
"iconset": "freepik-gadgets",
"icon": "screen-and-tower",
"icon_size": 32,
"row": 11,
"col": 10
}
],
"row": 0,
"col": 3,
"sizeX": 3,
"tile": {
"backdrop_iconset": "freepik-household",
"backdrop_icon": "television-4"
},
"sizeY": 1,
"$$hashKey": "object:47"
}
The AutoPause functionality is linked to a set of items + rules integrated with the motion senors that I have. Obviously you would need to edit this to suit your own items etc.
The basic design idea was to:
Work out where I am based on the last motion sensor that was triggered in the house 'VAR_WhereIsAndyā
Do nothing if the house is empty VAR_Mode
If I am in the lounge, set the Tivo to play(if paused)
If I am anywhere else set the TiVo to pause (if playing)
It works if you are the only one in the house, annoying as hell if you are not! Hence the ability to turn the functionality on and off. Itās a complicated as I need, so does the job until I can come up with something better.
Here are the key rules that so all of that. The rules are broken up as they will be extended when I get a chance to also turn on / off lights depending on where I am wandering at the timeā¦
The standby functionality is driven by the power to my TV. When I turn this off the TiVo gets put into standby. When powered on the āTIVOā menu option is sent which wakes it up. You may find you need to add a sleep command before you wake up the TiVo. BTW a WOL packet to TiVo does nothing, the network interface stays up even in standby i.e. it is still awake.
Hope this helps, shout if you have any questions.
// Variables
var wakeUpDimmer = 0
// Rules
rule "Initialise Location"
when
System started
then
// set values so that the scripts below do not fail due to null values
logInfo("location.InitialiseLocation", "Script start...")
Thread::sleep(120000)
if(Tivo_PlayPause.state == NULL) { postUpdate(Tivo_PlayPause, 1) }
if(Tivo_AutoPause.state == NULL) { postUpdate(Tivo_AutoPause, ON) }
if(VAR_Mode.state == NULL) { postUpdate(VAR_Mode, 1) }
if(VAR_WhereIsAndy.state == NULL) { postUpdate(VAR_WhereIsAndy, "AWAY") }
end
rule "Prescence"
when
Item FGMS_Hall_Motion changed from OFF to ON or
Item FGMS_Dinning_Motion changed from OFF to ON or
Item FGMS_Lounge_Motion changed from OFF to ON or
Item AMS_Bath_Motion changed from OFF to ON or
Item VAR_Mode changed
then
logInfo("location.prescence", "Script start...")
logInfo("location.prescence", ".AutoPause: " + Tivo_AutoPause.state)
logInfo("location.prescence", ".AutoPause: " + VAR_Mode.state)
if(VAR_Mode.state==1 || VAR_Mode.state==2) {
// find the last motion sensor that triggered the change
val lastItem = grpMotionSens.members.sortBy[lastUpdate].last
// Grab name of item
val nameOfItem = lastItem.name
logInfo("location.prescence", ".Motion trigger: " + nameOfItem)
if (nameOfItem=="FGMS_Hall_Motion") {
VAR_WhereIsAndy.postUpdate("HALL")
if(Tivo_PlayPause.state==1 && Tivo_AutoPause.state==ON && TiVo_SetPoint.state < 900) {
logDebug("location.prescence", ".Set TIVO Play Pause: PAUSE")
postUpdate(Tivo_PlayPause, 2)
}
}
if (nameOfItem=="FGMS_Dinning_Motion") {
VAR_WhereIsAndy.postUpdate("KITCHEN / DINNING")
if(Tivo_PlayPause.state==1 && Tivo_AutoPause.state==ON && TiVo_SetPoint.state < 900) {
logDebug("location.prescence", ".Set TIVO Play Pause: PAUSE")
postUpdate(Tivo_PlayPause, 2)
}
}
if (nameOfItem=="FGMS_Lounge_Motion") {
VAR_WhereIsAndy.postUpdate("LOUNGE")
if(Tivo_PlayPause.state==2 && Tivo_AutoPause.state==ON && TiVo_SetPoint.state < 900) {
logDebug("location.prescence", ".Set TIVO Play Pause: PLAY")
postUpdate(Tivo_PlayPause, 1)
}
}
if (nameOfItem=="AMS_Bath_Motion") {
VAR_WhereIsAndy.postUpdate("1st Floor")
if(Tivo_PlayPause.state==1 && Tivo_AutoPause.state==ON && TiVo_SetPoint.state < 900) {
logDebug("location.prescence", ".Set TIVO Play Pause: PAUSE")
postUpdate(Tivo_PlayPause, 2)
}
}
}
else {
VAR_WhereIsAndy.postUpdate("Away")
sendCommand(TiVo_IRCmd,"STANDBY")
}
end
// Forces the Tivo into PLAY mode if AUTO pause is turned off
rule "Tivo AutoPauseOff"
when
Item Tivo_AutoPause changed from ON to OFF
then
if (Tivo_PlayPause.state==2) {
postUpdate(Tivo_PlayPause, 1)
}
end
rule "Tivo Play / Pause"
when
Item Tivo_PlayPause changed
then
logInfo("location.Tivo Play / Pause", "Tivo_PlayPause.state: " + Tivo_PlayPause.state)
if (Tivo_PlayPause.state==1) {
// PLAY active Tivo media
sendCommand(TiVo_IRCmd,"PLAY")
}
else {
// PAUSE active Tivo media
// Workaround: Issue a play before pause as sending the PAUSE command when the media is already
// paused causes the media to play... there is no way to determine current state of media play
//sendCommand(TiVo_IRCmd,"PLAY")
sendCommand(TiVo_IRCmd,"PAUSE")
}
end
rule "TivoPowerSaver"
when
Item Power1_GF_Living changed
then
logInfo("TivoPowerSaver", "Tivo power state updated to " + Power1_GF_Living.state)
if (Power1_GF_Living.state == ON){
logInfo("TivoPowerSaver", "...Power up")
sendCommand(TiVo_ChangeScreen, "TIVO")
}
else
{
logInfo("TivoPowerSaver", "...Power down")
sendCommand(TiVo_IRCmd, "STANDBY")
}
end