I have done a rough widget and rule that works with Telstra TV (roku).
Rule code:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: rokuitem
type: core.ItemStateUpdateTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/javascript
script: >-
//need below to log to openhab.log file
var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);
//below is if you are going to use the ececute command
var Exec = Java.type("org.openhab.core.model.script.actions.Exec");
//below is also needed for the execute command
var Duration = Java.type("java.time.Duration");
var HttpUtil = Java.type("org.openhab.core.io.net.http.HttpUtil");
var HttpGet = Java.type("org.openhab.core.model.script.actions.HTTP");
//below is the Telstra TV settings
var PORT = "8060"
var IP = "192.168.1.161"
var stateof = event.itemState.toString() ;
logger.info("results = " + stateof);
switch(stateof) {
case "KEY_POWER":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Home", 20000);
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/PowerOff", 20000);
logger.info('Play key pressed');
break;
case "KEY_PLAY":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Play", 20000);
logger.info('Play key pressed');
break;
case "KEY_PAUSE":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Play", 20000);
logger.info('Play key pressed');
break;
case "KEY_REWIND":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Rev", 20000);
logger.info('Play key pressed');
break;
case "KEY_FF":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Fwd", 20000);
logger.info('Play key pressed');
break;
case "KEY_UP":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Up", 20000);
logger.info('Play key pressed');
break;
case "KEY_LEFT":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Left", 20000);
logger.info('Play key pressed');
break;
case "KEY_ENTER":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Select", 20000);
logger.info('Play key pressed');
break;
case "KEY_RIGHT":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Right", 20000);
logger.info('Play key pressed');
break;
case "KEY_DOWN":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Down", 20000);
logger.info('Play key pressed');
break;
case "KEY_HOME":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Home", 20000);
logger.info('Play key pressed');
break;
case "KEY_RETURN":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/InstantReplay", 20000);
logger.info('Play key pressed');
break;
case "KEY_BACK":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/keypress/Back", 20000);
logger.info('Play key pressed');
break;
case "KEY_NETFLIX":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/launch/12", 20000);
logger.info('Play key pressed');
break;
case "KEY_AMAZON":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/launch/13", 20000);
logger.info('Play key pressed');
break;
case "KEY_SBS":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/launch/65507", 20000);
logger.info('SBS key pressed');
break;
case "KEY_IVIEW":
HttpUtil.executeUrl("POST","http://"+IP+":"+PORT+"/launch/73305", 20000);
logger.info('KEY_IVIEW key pressed');
break;
default:
logger.info('Nothing ran');
}
/*
curl "http://192.168.1.50:8060/query/apps"
<?xml version="1.0" encoding="UTF-8" ?>
<apps>
<app id="62034" type="appl" version="3.7.0">Telstra TV Box Office</app>
<app id="587447" type="appl" version="1.8.4">Binge Entertainment</app>
<app id="71361" type="appl" version="3.27.3321">Stan</app>
<app id="12" type="appl" version="4.2.98018037">Netflix</app>
<app id="262035" type="appl" version="1.17.134">Kayo Sports. Stream Live Sport</app>
<app id="13" type="appl" version="11.4.2020092816">Prime Video</app>
<app id="65509" type="appl" version="4.5.0">7plus</app>
<app id="65575" type="appl" version="3.8.116">9Now</app>
<app id="74349" type="appl" version="5.1.2">10 play</app>
<app id="73305" type="appl" version="5.0.3">ABC iview</app>
<app id="65507" type="appl" version="2.5.226">SBS On Demand</app>
<app id="837" type="appl" version="1.0.80000314">YouTube</app>
</apps>
*/
type: script.ScriptAction
Widget code:
uid: Remote roku
tags: []
props:
parameters:
- context: item
description: Select the remote you wish to use at an equipment item level
label: Select Equipment
name: item
required: true
type: TEXT
parameterGroups: []
timestamp: Jul 3, 2021, 4:54:59 PM
component: f7-block
config:
style:
box-shadow: 2px 3px rgb(150,150,150)
background-color: rgb(192, 192, 192)
--f7-card-margin-horizontal: 0px
border-radius: 30px
width: 15rem
height: 40rem
slots:
default:
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 65px
top: 20px
width: 110px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 28px
left: 108px
color: red
iconF7: power
iconSize: 25
action: command
actionCommand: KEY_POWER
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 90px
top: 110px
width: 60px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 116px
left: 95px
color: white
iconF7: play
iconSize: 25
action: command
actionCommand: KEY_PLAY
actionItem: =props.item
- component: oh-link
config:
style:
position: absolute
top: 116px
left: 117px
color: white
iconF7: pause
iconSize: 25
action: command
actionCommand: KEY_PAUSE
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 20px
top: 110px
width: 60px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 117px
left: 35px
color: white
iconF7: backward
iconSize: 25
action: command
actionCommand: KEY_REWIND
actionItem: =props.item
- component: oh-link
config:
style:
position: absolute
top: 117px
right: 35px
color: white
iconF7: forward
iconSize: 25
action: command
actionCommand: KEY_FF
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
right: 20px
top: 110px
width: 60px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 197px
left: 103px
color: white
z-index: 2
iconF7: arrowtriangle_up
iconSize: 35
action: command
actionCommand: KEY_UP
actionItem: =props.item
- component: oh-link
config:
style:
position: absolute
top: 263px
left: 35px
color: white
z-index: 2
iconF7: arrowtriangle_left
iconSize: 35
action: command
actionCommand: KEY_LEFT
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 80px
top: 242px
width: 80px
height: 80px
border-radius: 50%
border: gray solid 1px
z-index: 2
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 30px
top: 190px
width: 180px
height: 180px
border-radius: 50%
z-index: 1
- component: oh-link
config:
text: OK
style:
font-size: 25px
position: absolute
top: 261px
left: 103px
color: white
z-index: 3
iconSize: 75
action: command
actionCommand: KEY_ENTER
actionItem: =props.item
- component: oh-link
config:
style:
position: absolute
top: 263px
right: 35px
color: white
iconF7: arrowtriangle_right
iconSize: 35
action: command
actionCommand: KEY_RIGHT
actionItem: =props.item
- component: oh-link
config:
style:
position: absolute
top: 330px
left: 103px
color: white
iconF7: arrowtriangle_down
iconSize: 35
action: command
actionCommand: KEY_DOWN
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 80px
top: 385px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 392px
left: 108px
color: white
iconF7: house
iconSize: 25
action: command
actionCommand: KEY_HOME
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 20px
top: 440px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 446px
left: 45px
color: white
iconF7: arrow_left
iconSize: 25
action: command
actionCommand: KEY_BACK
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
right: 20px
top: 440px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 447px
right: 45px
color: white
iconF7: arrow_counterclockwise
iconSize: 25
action: command
actionCommand: KEY_RETURN
actionItem: =props.item
- component: f7-badge
config:
bgColor: black
style:
position: absolute
right: 20px
top: 495px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 505px
right: 35px
color: white
iconSize: 25
action: command
actionCommand: KEY_AMAZON
actionItem: =props.item
text: Amazon
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 20px
top: 495px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 505px
left: 35px
color: white
iconSize: 25
action: command
actionCommand: KEY_NETFLIX
actionItem: =props.item
text: Netflix
- component: f7-badge
config:
bgColor: black
style:
position: absolute
left: 20px
top: 545px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 555px
left: 35px
color: white
iconSize: 25
action: command
actionCommand: KEY_SBS
actionItem: =props.item
text: SBS
- component: f7-badge
config:
bgColor: black
style:
position: absolute
right: 20px
top: 545px
width: 80px
height: 40px
border-radius: 12px
- component: oh-link
config:
style:
position: absolute
top: 555px
right: 35px
color: white
iconSize: 25
action: command
actionCommand: KEY_IVIEW
actionItem: =props.item
text: iVeiw
- component: oh-link
config:
color: red
style:
font-size: 25px
position: absolute
left: 25px
top: 600px
width: 200px
height: 40px
display: flex
text: Telstra TV
It is a bit rough but works.
Just create a string item called rokuitem and it should work.
Also set your IP address as static so it stays the same as that is hard coded into the rule.
No warranty.