Node-red-contrib-lgtv: Get event when playback is started/stopped/paused

Hi folks. For some automation, I want to get a message when the playback in the LG TV starts, pauses or stops. In node-red-contrib-lgtv, I could not find a node that does that out of the box, so I figured I'd have to execute a custom request via the request node.

The only example I have, is with the call to ssap://com.webos.applicationManager/listLaunchPoints as in this example:

[{"id":"44404f08c891504a","type":"tab","label":"Flow 5","disabled":false,"info":"","env":[]},{"id":"2d7db78b056b985c","type":"function","z":"44404f08c891504a","name":"Req","func":"return {\n    topic: 'ssap://com.webos.applicationManager/listLaunchPoints',\n    payload: {}\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":80,"wires":[["ad1978e324c0b914"]]},{"id":"ad1978e324c0b914","type":"lgtv-request","z":"44404f08c891504a","tv":"262df58758352518","name":"","x":420,"y":80,"wires":[["c99c20038f951028"]]},{"id":"c99c20038f951028","type":"debug","z":"44404f08c891504a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":80,"wires":[]},{"id":"80bb01aa35452fb9","type":"inject","z":"44404f08c891504a","name":"Kick","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":110,"y":80,"wires":[["2d7db78b056b985c"]]},{"id":"262df58758352518","type":"lgtv-config","host":"10.0.20.108"}]

So, I found what I think is the documentation of that API at https://www.webosose.org/docs/reference/ls2-api/. It looks like I want to

use getActiveMediaSessions from com.webos.service.mediacontroller to find out what's currently playing and then

execute getMediaPlayStatus with the mediaId from the previous call.

So I tried this:

[{"id":"6137c517d0d8507e","type":"function","z":"1876d14aa9a7dd74","name":"Req","func":"return {\n    topic: 'ssap://com.webos.mediaController/getActiveMediaSessions',\n    payload: {}\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":60,"wires":[["9f11be86a663cf08"]]}]

but all I get is

{ empty } 

from the debug node.

Any idea what I am doing wrong? I am watching the TV playing media while trying this, so I know it is actually playing something.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.