Here is my node red
[
{
“id”: “c592a56bbd24d448”,
“type”: “tab”,
“label”: “Flow 1”,
“disabled”: false,
“info”: “”,
“env”:
},
{
“id”: “0a639ba982f0484b”,
“type”: “group”,
“z”: “c592a56bbd24d448”,
“name”: “MediaPlaying”,
“style”: {
“label”: true
},
“nodes”: [
“df0176b5357a1bcd”,
“e015631433c83b95”,
“96e2a2fa2048dea9”,
“f22935a04c656ab7”,
“c96c4062ee487fe5”,
“69554bbb79b951fd”,
“f507d6c4318014b8”,
“8230733914cdfc67”
],
“x”: 34,
“y”: 79,
“w”: 1132,
“h”: 262
},
{
“id”: “df0176b5357a1bcd”,
“type”: “function”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “Get data”,
“func”: “var pic = "http://192.168.0.163:8123" + msg.data.attributes.entity_picture;\n\nvar filename = msg.data.attributes.media_title.replace(/\ /g, "");\nvar savepic = "/config/www/nowpalying/" + filename + ".jpg"\nsavepic = "/home/jason/Pictures/" + filename + ".jpg"\n\n\nvar picurl = "https://xxxx.ui.nabu.casa/local/nowpalying/\” + filename + ".jpg"\n\nvar output = msg.data.entity_id.split(".");\nvar title = msg.data.attributes.media_title\nvar artist = msg.data.attributes.app_name\nmsg = {}\nmsg = {\n pic: pic,\n savepic: savepic,\n picurl: picurl,\n keyword: output[1] + "Media",\n device: output[1],\n title: title,\n artist: artist,\n album:"",\n}\nreturn msg;\n",
“outputs”: 1,
“timeout”: “”,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 600,
“y”: 120,
“wires”: [
[
“c96c4062ee487fe5”
]
]
},
{
“id”: “e015631433c83b95”,
“type”: “server-state-changed”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “”,
“server”: “”,
“version”: 5,
“outputs”: 1,
“exposeAsEntityConfig”: “”,
“entityIdType”: “exact”,
“outputInitially”: false,
“stateType”: “str”,
“ifState”: “”,
“ifStateType”: “str”,
“ifStateOperator”: “is”,
“outputOnlyOnStateChange”: true,
“for”: “0”,
“forType”: “num”,
“forUnits”: “minutes”,
“ignorePrevStateNull”: false,
“ignorePrevStateUnknown”: false,
“ignorePrevStateUnavailable”: false,
“ignoreCurrentStateUnknown”: false,
“ignoreCurrentStateUnavailable”: false,
“outputProperties”: [
{
“property”: “payload”,
“propertyType”: “msg”,
“value”: “”,
“valueType”: “entityState”
},
{
“property”: “data”,
“propertyType”: “msg”,
“value”: “”,
“valueType”: “eventData”
},
{
“property”: “topic”,
“propertyType”: “msg”,
“value”: “”,
“valueType”: “triggerId”
}
],
“x”: 170,
“y”: 120,
“wires”: [
[
“f507d6c4318014b8”
]
]
},
{
“id”: “96e2a2fa2048dea9”,
“type”: “switch”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “playing”,
“vt”: “str”
},
{
“t”: “neq”,
“v”: “playing”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 2,
“x”: 490,
“y”: 180,
“wires”: [
[
“df0176b5357a1bcd”
],
[
“f22935a04c656ab7”
]
]
},
{
“id”: “f22935a04c656ab7”,
“type”: “function”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “Get entity_id”,
“func”: “var output = msg.data.entity_id.split(".");\n\nmsg = {}\nmsg = {\n keyword: output[1] + "Media",\n}\nreturn msg;\n”,
“outputs”: 1,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 610,
“y”: 300,
“wires”: [
]
},
{
“id”: “c96c4062ee487fe5”,
“type”: “http request”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “”,
“method”: “GET”,
“ret”: “bin”,
“paytoqs”: “ignore”,
“url”: “{{{pic}}}”,
“tls”: “”,
“persist”: false,
“proxy”: “”,
“insecureHTTPParser”: false,
“authType”: “”,
“senderr”: false,
“headers”: ,
“x”: 830,
“y”: 200,
“wires”: [
[
“69554bbb79b951fd”
]
]
},
{
“id”: “69554bbb79b951fd”,
“type”: “file”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “”,
“filename”: “savepic”,
“filenameType”: “msg”,
“appendNewline”: true,
“createDir”: false,
“overwriteFile”: “true”,
“encoding”: “none”,
“x”: 1080,
“y”: 200,
“wires”: [
]
},
{
“id”: “f507d6c4318014b8”,
“type”: “api-current-state”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “”,
“server”: “”,
“version”: 3,
“outputs”: 1,
“halt_if”: “”,
“halt_if_type”: “str”,
“halt_if_compare”: “is”,
“entity_id”: “media_player.living_room”,
“state_type”: “str”,
“blockInputOverrides”: false,
“outputProperties”: [
{
“property”: “payload”,
“propertyType”: “msg”,
“value”: “”,
“valueType”: “entityState”
},
{
“property”: “data”,
“propertyType”: “msg”,
“value”: “”,
“valueType”: “entity”
}
],
“for”: “0”,
“forType”: “num”,
“forUnits”: “minutes”,
“override_topic”: false,
“state_location”: “payload”,
“override_payload”: “msg”,
“entity_location”: “data”,
“override_data”: “msg”,
“x”: 300,
“y”: 240,
“wires”: [
[
“96e2a2fa2048dea9”
]
]
},
{
“id”: “8230733914cdfc67”,
“type”: “inject”,
“z”: “c592a56bbd24d448”,
“g”: “0a639ba982f0484b”,
“name”: “”,
“props”: [
{
“p”: “payload”
},
{
“p”: “topic”,
“vt”: “str”
}
],
“repeat”: “”,
“crontab”: “”,
“once”: false,
“onceDelay”: 0.1,
“topic”: “”,
“payload”: “”,
“payloadType”: “date”,
“x”: 140,
“y”: 180,
“wires”: [
[
“f507d6c4318014b8”
]
]
}
]