Navigation API
Navigation macros. These should return a boolean if they succeed. If not possible to ascertain they should print a warning
navigateTo.app
Signatures
app(index)
Description
Navigate to an app by its position index on the home screen.
This function first navigates to the home screen, then moves to the app at the specified index position. The navigation pattern varies by device type.
Parameters
index
- Zero-based index of the app position (0 = first app, 1 = second app, etc.)
Device-specific behavior:
- Hisense - Navigates through a 6-column grid layout
- Samsung - Moves right through app list with timing delays
- Vizio - Accounts for offset positioning (+3)
- LG C3 US - Simple right navigation (+1 offset)
- LG (general) - Direct right navigation by index
Returns true
when navigation is complete.
Example
-- Navigate to the third app (index 2)
local success = navigateTo.app(2)
if success then
print("Navigated to app at position 3")
end
navigateTo.home
Signatures
home()
home(homeText, presses \ 1, timeout \ 5000)
Description
Navigate to home screen using device-specific logic.
This function automatically detects the device type and uses the appropriate navigation sequence to reach the home screen. Each device brand has its own optimized navigation pattern.
Supported devices:
- Hisense - Navigates to "For You" or "Live" sections
- LG C3 US - Handles special left navigation and "Home Office" text
- Samsung - Looks for "Recent" or "On Now" sections
- Vizio - Complex navigation through "Apps" and "Inputs"
- Roku - Simple home navigation with "Home" text
- LG (general) - Looks for "Start" text
Returns true
on successful navigation.
Example
local success = navigateTo.home()
if success then
print("Device is now at home screen")
end
navigateTo.home
Signatures
home()
home(homeText, presses \ 1, timeout \ 5000)
Description
Navigate to home screen and wait for specific text to confirm arrival.
This is a fallback option that presses the home button a specified number of times and waits for expected text to appear on screen.
Parameters
homeText
- Text or list of text strings to wait for after pressing homepresses
- Number of times to press the home button (default: 1)timeout
- Maximum time in milliseconds to wait for the text (default: 5000)
Returns true
if the expected text is found, false
otherwise.
Example
local success = navigateTo.home("Home", 2, 3000)
if success then
print("Successfully navigated to home")
end