Luna command cheatsheet

enable display of power on hours in EU models

luna-send -n 1 'luna://com.webos.service.config/setConfigs' '{"configs": {"tv.conti.supportUsedTime": true}}'

then see power on hours in settings -> Support -> TV Information -> Total Power On Time.

open/close youtube video

luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"youtube.leanback.v4", "params": {"contentTarget":"v=dQw4w9WgXcQ"}}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"youtube.leanback.v4"}'
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id": "youtube.leanback.v4", "params": {"target": "q=queen"}}'

send input to native inputs

works only if native keyboard is shown (which means it won't work in apps with custom input like youtube)

# replace the entire input with text `new text here`
luna-send -n 1 luna://com.webos.service.ime/insertText '{"text": "new text here", "replace": true}'

# delete one character
luna-send -n 1 luna://com.webos.service.ime/deleteCharacters '{"count": 1}'

power on / off / reboot

## reboot
luna-send -n 1 'luna://com.webos.service.tvpower/power/reboot' '{"reason":"remoteKey"}'

## power on
luna-send -n 1 'luna://com.webos.service.tvpower/power/powerOn' '{"reason":"localKey"}'

## power off
luna-send -n 1 'luna://com.webos.service.tvpower/power/powerOff' '{"reason":"localKey"}'

## turn on screen
luna-send -n 1 "luna://com.webos.service.tvpower/power/turnOnScreen" '{}'

## turn off screen
luna-send -n 1 "luna://com.webos.service.tvpower/power/turnOffScreen" '{}'

## watch current power states
luna-send -i 'luna://com.webos.service.tvpower/power/getPowerState' '{"subscribe":true}'
## -> { "state": "Active", "subscribed": true, "returnValue": true }
## -> { "returnValue": true, "state": "Active", "processing": "Request Power Off", "onOff": "off", "reason": "remoteKey" }
## -> { "returnValue": true, "state": "Active", "processing": "Request Active Standby", "onOff": "off", "reason": "remoteKey" }
## -> { "returnValue": true, "state": "Active", "processing": "Prepare Active Standby", "onOff": "off", "reason": "remoteKey" }
## -> { "returnValue": true, "state": "Active Standby" }
## -> { "returnValue": true, "state": "Active Standby", "processing": "Prepare Power On", "onOff": "on", "reason": "remoteKey" }
## -> { "returnValue": true, "state": "Active Standby", "processing": "LastInput Ready", "onOff": "on", "reason": "remoteKey" }
## -> { "returnValue": true, "state": "Active Standby", "processing": "Screen On", "onOff": "on", "reason": "remoteKey" }
## -> { "returnValue": true, "state": "Active" }

launching and killing apps

## home screen
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"com.webos.app.home"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"com.webos.app.home"}'

## HDMI1
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"com.webos.app.hdmi1"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"com.webos.app.hdmi1"}'

## HDMI2
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"com.webos.app.hdmi2"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"com.webos.app.hdmi2"}'

## HDMI3
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"com.webos.app.hdmi3"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"com.webos.app.hdmi3"}'

## youtube
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"youtube.leanback.v4"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"youtube.leanback.v4"}'

## homebrew
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"org.webosbrew.hbchannel"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"org.webosbrew.hbchannel"}'

## lg store
luna-send -n 1 -f luna://com.webos.service.applicationManager/launch '{"id":"com.webos.app.discovery"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"com.webos.app.discovery"}'

## live TV app
luna-send -n 1 luna://com.webos.service.applicationManager/launch '{"id":"com.webos.app.livetv"}'
luna-send -n 1 'luna://com.webos.service.applicationManager/closeByAppId' '{"id":"com.webos.app.livetv"}'
# alternative way to kill home
pkill -f com.webos.app.home
## watch ids of currently opened apps
luna-send -i 'luna://com.webos.applicationManager/getForegroundAppInfo' '{"subscribe":true}'
# -> {"subscribed":true,"returnValue":true,"appId":"com.webos.app.home","processId":"","windowId":""}

## or just get currently opened app id without watching
luna-send -n 1 'luna://com.webos.applicationManager/getForegroundAppInfo' '{"subscribe":true}'
# -> {"subscribed":true,"returnValue":true,"appId":"com.webos.app.home","processId":"","windowId":""}
## alternative way to list store installed app ids with install dates
ls -lah /media/cryptofs/apps/usr/palm/applications


## list dev app ids with install dates
ls -lah /media/developer/apps/usr/palm/applications/

change oled brightness

## change oled brightness
luna-send -f -n 1 luna://com.webos.settingsservice/setSystemSettings '{"category": "picture","settings": {"backlight": 100}}'
luna-send -f -n 1 luna://com.webos.settingsservice/setSystemSettings '{"category": "picture","settings": {"backlight": 90}}'
luna-send -f -n 1 luna://com.webos.settingsservice/setSystemSettings '{"category": "picture","settings": {"backlight": 0}}'

## check the current values - just for backlight
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "picture", "key": "backlight"}'
## -> {"subscribed":false,"category":"picture","method":"getSystemSettings","dimension":{"pictureMode":"normal","input":"default"},"settings":{"backlight":0},"returnValue":true}

## watch for 
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "picture", "key": "backlight"}'

## or check the current setting - for entire picture category
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "picture"}'

change sound output

luna-send -f -n 1 luna://com.webos.settingsservice/setSystemSettings '{"category": "sound","settings": {"soundOutput":"external_arc"}}'
luna-send -f -n 1 luna://com.webos.settingsservice/setSystemSettings '{"category": "sound","settings": {"soundOutput":"tv_speaker"}}'

## list all the sound output options (= list the settings for sound category)
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "sound"}'

## watch for changes in sound output
luna-send -i 'luna://com.webos.settingsservice/getSystemSettings' '{"subscribe":true,"category": "sound","keys":["soundOutput"]}'
## -> {"subscribed":true,"category":"sound","method":"getSystemSettings","dimension":{},"settings":{"soundOutput":"external_arc"},"returnValue":true}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.app.quicksettings","settings":{"soundOutput":"tv_speaker"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.service.audio","settings":{"soundOutput":"tv_speaker"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.app.quicksettings","settings":{"soundOutput":"external_optical"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.service.audio","settings":{"soundOutput":"external_optical"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.app.quicksettings","settings":{"soundOutput":"tv_external_speaker"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.service.audio","settings":{"soundOutput":"tv_external_speaker"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.app.quicksettings","settings":{"soundOutput":"external_arc"},"dimension":{}}
## -> {"returnValue":true,"method":"getSystemSettings","app_id":"","category":"sound","caller":"com.webos.service.audio","settings":{"soundOutput":"external_arc"},"dimension":{}}

all the options (for my TV)

  • tv_speaker
  • external_optical
  • external_arc
  • external_arc_bno
  • external_arc_sound_alive
  • external_arc_sound_mode_sync
  • lineout
  • headphone
  • tv_external_speaker
  • tv_speaker_headphone
  • alsa
  • wisa_speaker
  • lgSoundSync
  • bt_soundbar
  • tv_speaker_optical_arc
  • tv_speaker_bluetooth
  • tv_speaker_bt_surround
  • mobile_phone
  • tv_speaker_external_arc
  • tv_speaker_external_arc_harmony
  • usb_speaker
  • wow_cast
  • tv_speaker_wow_cast
  • bt_atmos
  • urcu_oss

change volume

## watch for volume changes
luna-send -i 'luna://com.webos.settingsservice/getSystemSettings' '{"subscribe":true,"category": "sound","keys":["volume"]}'
## -> (LARGE OUTPUT)

## change volume - is there a simple way to change it?

all settings (by categories)

luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "sound"}'
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "picture"}'
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "general"}'
luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category": "other"}'

toasts and alerts

## simple message
luna-send -a webosbrew -f -n 1 luna://com.webos.notification/createToast '{"sourceId":"webosbrew","message": "<b>Failsafe mode!</b><br/>A crash has occured during startup. Fix any causes and reboot."}'

## run luna-send command on button click
luna-send -a com.webos.service.secondscreen.gateway -f -n 1 luna://com.webos.notification/createAlert '{"sourceId":"webosbrew","message":"<b>Homebrew Channel</b> - Failsafe mode<br />A crash has occured during previous startup - root-related system customizations have been temporarily disabled.<br /><br /> System should go back to normal after a reboot.<br />Would you like to reboot now?","buttons":[{"label":"Reboot now","onclick":"luna://com.webos.service.sleep/shutdown/machineReboot","params":{"reason":"remoteKey"}},{"label":"Reboot later"}]}'

# just a message with "OK" button and no action
luna-send -a com.webos.service.secondscreen.gateway -f -n 1 luna://com.webos.notification/createAlert '{"sourceId":"webosbrew","message":"Hello","buttons":[{"label":"OK"}]}'

take screenshot

## jpg format, save to /tmp/screenshot.jpg
luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/tmp/screenshot.jpg","format":"JPG"}'

## bmp format, save to /tmp/screenshot.bmp
luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/tmp/screenshot.bmp","format":"BMP"}'

## jpg format, save to /tmp/screenshot.jpg, set resolution
luna-send -n 1 luna://com.webos.service.capture/executeOneShot '{"path":"/tmp/screenshot.jpg","method":"DISPLAY","width":1920,"height":1080,"format":"JPEG"}'

## one liner to capture screenshot from the TV and save it in current working directory (assumes default config with unchanged password)
TV_HOST=192.168.77.113 TV_USER=root TV_PASSWORD=alpine; sshpass -p "$TV_PASSWORD" ssh "$TV_USER@$TV_HOST" 'payload="{\"output\":\"/tmp/screenshot.jpg\",\"format\":\"JPG\"}"; rm -f /tmp/screenshot.jpg; luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput "$payload"' && sshpass -p "$TV_PASSWORD" scp "$TV_USER@$TV_HOST:/tmp/screenshot.jpg" ./screenshot_$(date +%Y%m%d_%H%M%S).jpg

get TV system info

## get only TV mac address
luna-send -n 1 -f luna://com.webos.service.sm/deviceid/getIDs '{"idType":["MAC"],"origin":"com.webos.service.admanager"}'
## -> { "returnValue": true, "idList": [ { "idType": "MAC", "idValue": "00:01:02:03:04:05" } ] }

## include also other interesting system info
luna-send -n 1 -f luna://com.webos.service.sm/deviceid/getIDs '{"idType":["LGUDID","SDI","MAC","HashedMAC","NDUID","HBBTVID","IFAID"],"origin":"com.webos.service.admanager"}'

## get sdp headers
luna-send -n 1 -f luna://com.webos.service.sdx/getHttpHeaderForServiceRequest '{}'

sdp headers contain these keys:

  • X-Device-Type
  • X-Device-ID
  • X-Device-SDK-VERSION
  • X-Device-Product
  • Authorization
  • X-Device-Model
  • X-Device-Eula
  • X-Device-Remote-Flag
  • X-Device-Netcast-Platform-Version
  • X-Authentication
  • HOST
  • X-Device-Brand
  • X-Device-Locale
  • X-Device-Eco-Info
  • Accept
  • X-Device-Publish-Flag
  • header
  • X-Device-Platform
  • X-User-Number
  • X-Device-Language
  • X-Device-FCK
  • returnValue
  • X-Device-FW-Version
  • X-Device-Country-Group
  • X-Device-ContentsQA-Flag
  • X-Device-Sales-Model
  • X-SDPUser-Number
  • X-Device-Country

eula

## check eula status (only `networkAllowed` and `generalTermsAllowed` should be set to true)
luna-send -f -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"keys":["eulaStatus"]}'
## -> {
## ->     "subscribed": false,
## ->     "returnValue": true,
## ->     "method": "getSystemSettings",
## ->     "settings": {
## ->         "eulaStatus": {
## ->             "customadsAllowed": false,
## ->             "takeOnAllowed": false,
## ->             "additional3Allowed": false,
## ->             "acrOnAllowed": false,
## ->             "additionalDataAllowed": false,
## ->             "networkAllowed": true,
## ->             "chpAllowed": false,
## ->             "marketingOnAllowed": false,
## ->             "wasuOnAllowed": false,
## ->             "acrAllowed": false,
## ->             "additional4Allowed": false,
## ->             "voice2Allowed": false,
## ->             "additional1Allowed": false,
## ->             "acrGdprAllowed": false,
## ->             "remoteDiagAllowed": false,
## ->             "veranceOnAllowed": false,
## ->             "acrAdAllowed": false,
## ->             "additional5Allowed": false,
## ->             "generalTermsAllowed": true,
## ->             "customAdAllowed": false,
## ->             "additional2Allowed": false,
## ->             "thirdPartySharingAllowed": false,
## ->             "cookiesAllowed": false,
## ->             "shoppingOnAllowed": false,
## ->             "voiceAllowed": false
## ->         }
## ->     }
## -> }


## set eula (IMPORTANT - first do `luna-send -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"keys":["eulaStatus"]}'` and copy YOUR VALUES, these options vary between versions a lot)
luna-send -n 1 'luna://com.webos.settingsservice/setSystemSettings' '{"settings":{"eulaStatus": {"customadsAllowed": false, "takeOnAllowed": false, "additional3Allowed": false, "acrOnAllowed": false, "additionalDataAllowed": false, "networkAllowed": true, "chpAllowed": false, "marketingOnAllowed": false, "wasuOnAllowed": false, "acrAllowed": false, "additional4Allowed": false, "voice2Allowed": false, "additional1Allowed": false, "acrGdprAllowed": false, "remoteDiagAllowed": false, "veranceOnAllowed": false, "acrAdAllowed": false, "additional5Allowed": false, "generalTermsAllowed": true, "customAdAllowed": false, "additional2Allowed": false, "thirdPartySharingAllowed": false, "cookiesAllowed": false, "shoppingOnAllowed": false, "voiceAllowed": false}}}'

ads

## check only home promotion status
luna-send -f -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category":"general","keys":["homePromotion"]}'
## -> {"subscribed":false,"category":"general","method":"getSystemSettings","returnValue":true,"settings":{"homePromotion":"off"}}

## do not sell my personal info status
luna-send -f -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category":"general", "keys":["doNotSellMyPersonalInformation"]}'
## -> {"subscribed":false,"category":"general","method":"getSystemSettings","returnValue":true,"settings":{"doNotSellMyPersonalInformation":"off"}}

## or check all 4 multiple at the same time
luna-send -f -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category":"general","keys":["homePromotion", "doNotSellMyPersonalInformation", "screenSaverAd", "customizedAd"]}'

firmware updates

## are automatic updates turned on?
luna-send -f -n 1 'luna://com.webos.settingsservice/getSystemSettings' '{"category":"support", "keys": ["automaticUpdate"]}'
## -> {"subscribed":false,"category":"support","method":"getSystemSettings","returnValue":true,"settings":{"automaticUpdate":"off"}}

install app from remote url

wget https://github.com/NicholasBly/youtube-webos/releases/download/0.8.3/youtube.leanback.v4_0.8.3_all_webOS22+.ipk
luna-send -i -f luna://com.webos.appInstallService/dev/install '{"id":"youtube.leanback.v4","ipkUrl":"/home/root/youtube.leanback.v4_0.8.3_all_webOS22+.ipk","subscribe":true}'

monitor the bus

ls-monitor

configure VNC server

(requires VNC server)

luna-send -n 1 'luna://org.webosbrew.vncserver.service/configure' '{"width":1280, "height":720}'