klattimer/LGWebOSRemote

closeApp not working (403) when app not started via lgtv (this app)

Opened this issue · 4 comments

You can't use "lgtv myTV closeApp " to close an app that's not opened by "lgtv myTV startApp ".
It returns a 403Access denied error.

root@pc:~# lgtv "192.168.11.218" closeApp com.my.app
DEBUG:root:Initiating handshake
DEBUG:root:Received response
DEBUG:root:{"type":"registered","id":"register_0","payload":{"client-key":"*****"}}
DEBUG:root:Handshake complete
DEBUG:root:{'id': '0', 'type': 'request', 'uri': 'ssap://system.launcher/close', 'payload': '{"id": "com.my.app"}'}
DEBUG:root:Received response
DEBUG:root:{"type":"error","id":"0","error":"403 access denied","payload":{}}
DEBUG:root:{'type': 'error', 'id': '0', 'error': '403 access denied', 'payload': {}}
{"type": "error", "id": "0", "error": "403 access denied", "payload": {}}
{"type": "error", "id": "0", "error": "403 access denied", "payload": {}}
DEBUG:ws4py:Closing message received (1000) 'b'''
{"closing": {"code": 1000, "reason": ""}}

I think you need to pair it again, I've had this happen after an update on the tv firmware.

Unfortunately a new pairing didn't help.
This was the first I did.
Deleted file ~/.lgtv/config.json and started new pairing. Or is there any further step needed to "cleanup" than to remove this file?

Steps to reproduce in detail:
Pair TV with lgtv (this app)
Start any app on TV but NOT using lgtv command (using remote hardware directly), for example developer mode
Use lgtv myTV closeApp "com.palmdts.devmode"

The 403 error comes up.

you could try deleting the files, not sure how it deals with over-riding tbh, it's a long time since I looked at the code.

Have you tried with other apps?

It's not an actual solution but you can start the livetv "app" to switch, the app will still be open in the background but shouldn't interfere that much in terms of performance.