Getting media player source in node red current state node?

Hey all,

How can I use the current state node to drill down on a media player and check the source? I was thinking something like like this


But it just says playing regardless of the source :frowning:


Hope this helps someone; its

$entity().attributes.source = โ€œiPhoneโ€

i use this:

to check if my source is one of the list

[{"id":"a172843b743d9edf","type":"function","z":"5a62a7e4.2faa58","name":"check source","func":"var source =;\nvar sourcelist = [\"Plex\",\"Netflix\",\"YouTube\",\"KPN iTV\",\"NPO\"];\nmsg.payload\nif (sourcelist.includes(source)){ \n    return [null,msg];\n}\nreturn [msg,null];\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":160,"wires":[["154b86225393e378","c48c42a6.78523"],["6edda95325579a4a"]]}]

Cool thanks for that.

Iโ€™m using this to do follow me music, it just checks though some media players/ speaker groups and my phone and if none are playing. It switches the source depending on which motion sensor picked me up :slight_smile: