Kodi Media type eg Music,Movie,Concert in Node-Red

Is it possible to get the type of media playing from Kodi in node-red please. I cant figure out quite how to do the flow I’m trying to switch on different amps dependent on what Kodi is playing.
EG
Music = turn on amp 1
Move = turn on amp 1 + 2

Thanks if its possible.

Have you tried to use the kodi node https://flows.nodered.org/node/node-red-contrib-kodi ?
Using the kodi-out node you can listen to notification sent from Kodi.
The content of the notification will tell you what is played and then, you can do pretty much what you want…
GV

OK and thanks will try that.

OK I have Kodi out and with debug message i’m getting

kodi : msg.payload : Object
object
notification: "Playlist.OnAdd"
data: object
data: object
item: object
id: 356
type: "song"
playlistid: 0
position: 15
sender: "xbmc"

Now i’m not to sure how to make to make a switch to select each amp from here.

Thanks for any help

You should have more than one message when kodi starts playing something.
In the debug window open the data object. Try with a song, a movie,… and look at the various messages you have received. You should be able to differentiate between each type of media and react as you wish.

For example, in the output you gave “type” is “song”. Not a movie :slight_smile:

Plug a json node and access the various elements of the message.

GV

OK will try that thanks again

You can try this flow I made. Uses a http request to send a JSON command. You need to setup ip and username and password. You can change the type of request to anything listed here:
https://kodi.wiki/view/JSON-RPC_API/v9
I used “Player.GetActivePlayers”

[{"id":"7cbcf40a.ef84ec","type":"inject","z":"54477b72.9b0d74","name":"play","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":2140,"wires":[["ffe1468e.8481d8"]]},{"id":"ffe1468e.8481d8","type":"www-request","z":"54477b72.9b0d74","name":"","method":"GET","ret":"obj","url":"http://192.168.1.97:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22id%22:%201,%20%22method%22:%20%22Player.GetActivePlayers%22}","follow-redirects":false,"persistent-http":false,"tls":"","x":330,"y":2140,"wires":[["ea0dc6ed.05a5f8"]]},{"id":"ea0dc6ed.05a5f8","type":"debug","z":"54477b72.9b0d74","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":2140,"wires":[]}]

52 AM 40 AM

Hi OK great will try that latter tonight (out today) but thanks for the info :smile: