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

**URL:** <https://discourse.nodered.org/t/node-red-contrib-lgtv-get-event-when-playback-is-started-stopped-paused/65232>\
**Category:** General\
**Tags:** node-red-contrib-lgtv\
**Created:** [17 July 2022 18:21 UTC](https://discourse.nodered.org/t/node-red-contrib-lgtv-get-event-when-playback-is-started-stopped-paused/65232 "2022-07-17T18:21:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathias-ewald](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mathias-ewald/32/64611_2.png) [@mathias-ewald](https://discourse.nodered.org/u/mathias-ewald)\
**Post date:** [17 July 2022 18:21 UTC](https://discourse.nodered.org/t/node-red-contrib-lgtv-get-event-when-playback-is-started-stopped-paused/65232/1 "2022-07-17T18:21:50Z")

</div>

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:

```auto
[{"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/](https://www.webosose.org/docs/reference/ls2-api/). It looks like I want to

use [getActiveMediaSessions](https://www.webosose.org/docs/reference/ls2-api/com-webos-service-mediacontroller/#getactivemediasessions) from `com.webos.service.mediacontroller` to find out what's currently playing and then

execute [getMediaPlayStatus](https://www.webosose.org/docs/reference/ls2-api/com-webos-service-mediacontroller/#getmediaplaystatus) with the `mediaId` from the previous call.

So I tried this:

```auto
[{"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

```auto
{ 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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 September 2022 18:22 UTC](https://discourse.nodered.org/t/node-red-contrib-lgtv-get-event-when-playback-is-started-stopped-paused/65232/2 "2022-09-15T18:22:34Z")

</div>

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