[roku] Add rule examples for starting apps (#18154)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein
2025-01-23 14:41:10 +01:00
committed by GitHub
parent ed9bcf5f9b
commit 19d51b55d5
@@ -146,6 +146,9 @@ String Player_ChannelName "Channel Name: [%s]" { channel="roku
String Player_ProgramTitle "Program Title: [%s]" { channel="roku:roku_tv:mytv1:programTitle" }
String Player_ProgramDescription "Program Description: [%s]" { channel="roku:roku_tv:mytv1:programDescription" }
String Player_ProgramRating "Program Rating: [%s]" { channel="roku:roku_tv:mytv1:programRating" }
// A virtual switch used to trigger a rule to start a given app
Switch Player_StartYouTube "Start YouTube"
```
### `roku.sitemap` Example
@@ -174,6 +177,10 @@ sitemap roku label="Roku" {
Text item=Player_ProgramDescription
Text item=Player_ProgramRating
// Virtual switch/button to trigger a rule to start a given app
// The ON value displays as the button label
Switch item=Player_StartYouTube mappings=[ON="YouTube"]
// Buttongrid for Roku player
Buttongrid label="Remote Control" staticIcon=material:tv_remote item=Player_Button buttons=[1:1:Back="Back", 1:2:Home="Home"=f7:house, 1:3:Search="Search", 2:2:Up="Up"=f7:arrowtriangle_up, 4:2:Down="Down"=f7:arrowtriangle_down, 3:1:Left="Left"=f7:arrowtriangle_left, 3:3:Right="Right"=f7:arrowtriangle_right, 3:2:Select="Select", 5:1:InstantReplay="Instant Replay", 5:2:Info="Info*", 6:1:Rev="Reverse"=f7:backward, 6:2:Play="Play/Pause"=f7:playpause, 6:3:Fwd="Forward"=f7:forward, 7:1:Enter="Enter", 7:2:Backspace="Backspace", 7:3:FindRemote="Find Remote"]
@@ -182,3 +189,25 @@ sitemap roku label="Roku" {
}
}
```
### `roku.rules` Example
```java
rule "Start the YouTube app on Roku"
when
Item Player_StartYouTube received command
then
// Find the list of all installed apps and their IDs at http://$ROKU_IP:8060/query/apps
Player_ActiveApp.sendCommand("837")
// It is also possible to launch specific content within an app via deep-linking.
// See here for more details:
// https://virtu.is/frozen-buttons-launching-disney-movies-on-roku-with-automator/
// Command to start 'Frozen' on Disney+:
// Player_ActiveApp.sendCommand("291097?MediaType=movie&ContentID=8e06a8b7-d667-4e31-939d-f40a6dd78a88")
// Command to start 'Me at the zoo' on YouTube:
// Player_ActiveApp.sendCommand("837?contentId=jNQXAC9IVRw")
end
```