[ { "id": "6c0230df.62aff8", "type": "tab", "label": "Kodi", "disabled": false, "info": "" }, { "id": "ca0e80d.d92ef8", "type": "ping", "z": "6c0230df.62aff8", "mode": "timed", "name": "Server Pingen", "host": "192.168.123.101", "timer": "5", "inputs": 0, "x": 90, "y": 40, "wires": [ [ "45cd1134.ca532" ] ] }, { "id": "3d9709e.5434cf6", "type": "ui_switch", "z": "6c0230df.62aff8", "name": "Schalter zeigt ob MC an", "label": "Mediencenter läuft", "tooltip": "", "group": "6fc15530.2c7c3c", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 570, "y": 40, "wires": [ [ "8e0fae5e.32cb3" ] ] }, { "id": "45cd1134.ca532", "type": "function", "z": "6c0230df.62aff8", "name": "Ping umwandeln in an/aus", "func": "if(msg.payload==false){\n msg.payload=false;\n}\nelse msg.payload=true;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 300, "y": 40, "wires": [ [ "3d9709e.5434cf6" ] ] }, { "id": "3a5c02bf.4f63ae", "type": "http request", "z": "6c0230df.62aff8", "name": "", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://192.168.123.101/jsonrpc?request={\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"season\", \"episode\", \"duration\", \"showtitle\", \"tvshowid\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 1 }, \"id\": \"VideoGetItem\"}", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 1470, "y": 320, "wires": [ [ "bcf67c78.2d31e8" ] ] }, { "id": "9acd940e.345f88", "type": "ui_text", "z": "6c0230df.62aff8", "group": "6fc15530.2c7c3c", "order": 3, "width": "8", "height": "4", "name": "Ausgabe", "label": "", "format": "{{msg.payload}}", "layout": "row-center", "x": 620, "y": 780, "wires": [] }, { "id": "bcf67c78.2d31e8", "type": "function", "z": "6c0230df.62aff8", "name": "Video Typ Ermittlung und Laufzeit", "func": "if(msg.payload.result.item.label!=false){\n if(msg.payload.result.item.type==\"channel\"){\n msg.payload=\"

Fernsehen/PVR

Sender: \"+msg.payload.result.item.label+\"

Es läuft: \"+msg.payload.result.item.title+\"

\"; \n }\n else if(msg.payload.result.item.type==\"movie\")\n {\n hour=Math.floor(msg.payload.result.item.streamdetails.video[0].duration/3600);\n minute=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%3600/60);\n second=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%60);\n if(hour < 10){\n hour = \"0\"+hour;\n }\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n }\n msg.payload=\"

Filmtitel: \"+msg.payload.result.item.title+\"

Filmlänge: \"+hour+\":\"+minute+\":\"+second+\"

Format: \"+msg.payload.result.item.streamdetails.video[0].width+\"x\"+msg.payload.result.item.streamdetails.video[0].height+\"

Codec: \"+msg.payload.result.item.streamdetails.video[0].codec+\"

\";\n }\n else if(msg.payload.result.item.type==\"episode\")\n {\n hour=Math.floor(msg.payload.result.item.streamdetails.video[0].duration/3600);\n minute=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%3600/60);\n second=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%60);\n if(hour < 10){\n hour = \"0\"+hour;\n }\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n }\n msg.payload=\"

Serientitel: \"+msg.payload.result.item.showtitle+\"

Episode: \"+msg.payload.result.item.title+\"

Episodenlänge: \"+hour+\":\"+minute+\":\"+second+\"

Format: \"+msg.payload.result.item.streamdetails.video[0].width+\"x\"+msg.payload.result.item.streamdetails.video[0].height+\"

Codec: \"+msg.payload.result.item.streamdetails.video[0].codec+\"

\";\n }\n else if(msg.payload.result.item.type==\"unknown\"){\n hour=Math.floor(msg.payload.result.item.streamdetails.video[0].duration/3600);\n minute=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%3600/60);\n second=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%60);\n if(hour < 10){\n hour = \"0\"+hour;\n }\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n } \n msg.payload=\"

Videodatei

\"+msg.payload.result.item.label+\"

Format: \"+msg.payload.result.item.streamdetails.video[0].width+\"x\"+msg.payload.result.item.streamdetails.video[0].height+\"

Codec: \"+msg.payload.result.item.streamdetails.video[0].codec+\"

\";\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 320, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "8179f813.b9e4d8", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei Typ Video", "func": "if (msg.payload==true){\nmsg.payload = '{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"season\", \"episode\", \"duration\", \"showtitle\", \"tvshowid\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 1 }, \"id\": \"VideoGetItem\"}';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1170, "y": 320, "wires": [ [ "3a5c02bf.4f63ae" ] ] }, { "id": "8e0fae5e.32cb3", "type": "switch", "z": "6c0230df.62aff8", "name": "PC ist an/aus", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 800, "y": 40, "wires": [ [ "41b336ad.aadbb" ], [ "ec2ef628.71b658" ] ], "outputLabels": [ "An", "Aus" ] }, { "id": "f10df51a.0f3388", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei PC aus", "func": "if(msg.payload==false){\nmsg.payload=\"Mediacenter läuft nicht.\";\nreturn msg;\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 640, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "7710b7b6.d715c8", "type": "catch", "z": "6c0230df.62aff8", "name": "Fehler abfangen", "scope": [ "3a5c02bf.4f63ae", "55ed1a78.848a94", "8cc7f348.d7e4a8" ], "uncaught": false, "x": 140, "y": 920, "wires": [ [] ] }, { "id": "dfc43c35.900018", "type": "comment", "z": "6c0230df.62aff8", "name": "Falls PC erreichbar/Kodi aus gibt es dann doch Fehler", "info": "", "x": 260, "y": 860, "wires": [] }, { "id": "ac44ebef.f822c", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei Bildern", "func": "if(msg.payload==false){\nmsg.payload=\"Es wird ein Bild angezeigt.\";\nreturn msg;\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 420, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "55ed1a78.848a94", "type": "http request", "z": "6c0230df.62aff8", "name": "", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://192.168.123.101/jsonrpc?request={\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"duration\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 0 }, \"id\": \"AudioGetItem\"}", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 1470, "y": 220, "wires": [ [ "99e31030.44d448" ] ] }, { "id": "99e31030.44d448", "type": "function", "z": "6c0230df.62aff8", "name": "Audio Ausgabe generieren", "func": "if(msg.payload.result.item.label!=false){\n var url=decodeURIComponent(msg.payload.result.item.fanart);\n var newurl=url.replace(\"image://\",\"\");\n var newurl2=newurl.substring(0,newurl.length-1);\n minute=Math.floor(msg.payload.result.item.duration%3600/60);\n second=Math.floor(msg.payload.result.item.duration%60);\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n }\nmsg.payload = \"

Spielt Musik

Künstler:\"+msg.payload.result.item.artist[0]+\"

Titel:\"+msg.payload.result.item.title+\"

Länge:\"+minute+\":\"+second+\"

\";\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1720, "y": 220, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "ff455911.53792", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei Typ Audio", "func": "if (msg.payload==true){\nmsg.payload = '{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"duration\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 0 }, \"id\": \"AudioGetItem\"}';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1190, "y": 220, "wires": [ [ "55ed1a78.848a94" ] ] }, { "id": "ecb160d6.bef0f", "type": "function", "z": "6c0230df.62aff8", "name": "Ist audio", "func": "if(msg.payload.result[0].type==\"audio\")\n{\n msg.payload=true;\n}\nelse msg.payload=false;\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 900, "y": 220, "wires": [ [ "ff455911.53792" ] ] }, { "id": "ca837e56.ff2018", "type": "function", "z": "6c0230df.62aff8", "name": "ist video", "func": "if(msg.payload.result[0].type==\"video\")\n{\n msg.payload=true;\n}\nelse msg.payload=false;\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 900, "y": 320, "wires": [ [ "8179f813.b9e4d8" ] ] }, { "id": "c5228f74.9bfca8", "type": "function", "z": "6c0230df.62aff8", "name": "ist bilder", "func": "\nif(msg.payload.result[0].type==\"picture\")\n{\n msg.payload=true;\n}\nelse msg.payload=false;\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 880, "y": 420, "wires": [ [ "ac44ebef.f822c" ] ] }, { "id": "85882987.222cd", "type": "function", "z": "6c0230df.62aff8", "name": "Json rein", "func": "if (msg.payload==true){\nmsg.payload = '{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 240, "y": 140, "wires": [ [ "142dd76c.1bb369" ] ] }, { "id": "142dd76c.1bb369", "type": "http request", "z": "6c0230df.62aff8", "name": "Player aktiv?", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://192.168.123.101/jsonrpc?request={\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 510, "y": 140, "wires": [ [ "5e938e66.943a78" ] ] }, { "id": "5e938e66.943a78", "type": "function", "z": "6c0230df.62aff8", "name": "Auswertung", "func": "if(msg.payload.result.length==0){\n msg.payload=false;\n}\nelse {\n msg.payload=true;\n }\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 750, "y": 140, "wires": [ [ "881555c8.e7f81" ] ] }, { "id": "881555c8.e7f81", "type": "function", "z": "6c0230df.62aff8", "name": "Json vorbereiten", "func": "if (msg.payload==true){\nmsg.payload = '{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}';\n}\nelse msg.payload=\"Player inaktiv\";\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1050, "y": 140, "wires": [ [ "829fa203.523e5" ] ] }, { "id": "8cc7f348.d7e4a8", "type": "http request", "z": "6c0230df.62aff8", "name": "", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://192.168.123.101/jsonrpc?request={\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 330, "y": 360, "wires": [ [ "40a55492.4487a4" ] ] }, { "id": "829fa203.523e5", "type": "switch", "z": "6c0230df.62aff8", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}", "vt": "str" }, { "t": "eq", "v": "Player inaktiv", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1310, "y": 140, "wires": [ [ "9e25ef04.2eaaf8" ], [ "f999fa0e.8a3f48" ] ] }, { "id": "40a55492.4487a4", "type": "switch", "z": "6c0230df.62aff8", "name": "", "property": "msg.payload.result[0].type", "propertyType": "msg", "rules": [ { "t": "eq", "v": "audio", "vt": "str" }, { "t": "eq", "v": "video", "vt": "str" }, { "t": "eq", "v": "picture", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 570, "y": 360, "wires": [ [ "ecb160d6.bef0f" ], [ "ca837e56.ff2018" ], [ "c5228f74.9bfca8" ] ] }, { "id": "d21b39af.9c30a", "type": "function", "z": "6c0230df.62aff8", "name": "Player spielt nichts ab", "func": "if(msg.payload==\"Player inaktiv\"){\n msg.payload=\"Kodi spielt momentan nichts ab.\"\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 520, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "41b336ad.aadbb", "type": "link out", "z": "6c0230df.62aff8", "name": "PC ist an", "links": [ "91bb1fe.1bf8ce" ], "x": 1255, "y": 20, "wires": [], "inputLabels": [ "An" ] }, { "id": "91bb1fe.1bf8ce", "type": "link in", "z": "6c0230df.62aff8", "name": "PC ist an", "links": [ "41b336ad.aadbb" ], "x": 45, "y": 140, "wires": [ [ "85882987.222cd" ] ] }, { "id": "ec2ef628.71b658", "type": "link out", "z": "6c0230df.62aff8", "name": "PC ist aus", "links": [ "1a0e5e2.c697222" ], "x": 1255, "y": 60, "wires": [] }, { "id": "1a0e5e2.c697222", "type": "link in", "z": "6c0230df.62aff8", "name": "PC ist aus", "links": [ "ec2ef628.71b658" ], "x": 55, "y": 640, "wires": [ [ "f10df51a.0f3388" ] ] }, { "id": "e9337f9f.05b5a", "type": "comment", "z": "6c0230df.62aff8", "name": "Es wird nichts abgespielt, Kodi ist nicht erreichbar", "info": "", "x": 230, "y": 580, "wires": [] }, { "id": "90f331aa.cffc1", "type": "comment", "z": "6c0230df.62aff8", "name": "Es wird was abgespielt, Kodi ist ereichbar", "info": "", "x": 190, "y": 100, "wires": [] }, { "id": "9e25ef04.2eaaf8", "type": "link out", "z": "6c0230df.62aff8", "name": "Player spielt was ab", "links": [ "21d940f4.1a2208" ], "x": 1605, "y": 120, "wires": [] }, { "id": "21d940f4.1a2208", "type": "link in", "z": "6c0230df.62aff8", "name": "Player spielt was ab", "links": [ "9e25ef04.2eaaf8" ], "x": 65, "y": 360, "wires": [ [ "8cc7f348.d7e4a8" ] ] }, { "id": "26eade6e.763afa", "type": "comment", "z": "6c0230df.62aff8", "name": "Es wird was abgespielt, aber was?", "info": "", "x": 190, "y": 320, "wires": [] }, { "id": "f999fa0e.8a3f48", "type": "link out", "z": "6c0230df.62aff8", "name": "Es wird nichts abgespielt", "links": [ "c9d32391.a1b8" ], "x": 1565, "y": 160, "wires": [] }, { "id": "c9d32391.a1b8", "type": "link in", "z": "6c0230df.62aff8", "name": "Es wird nichts abgespielt", "links": [ "f999fa0e.8a3f48" ], "x": 65, "y": 520, "wires": [ [ "d21b39af.9c30a" ] ] }, { "id": "3ccceed0.5a744a", "type": "link out", "z": "6c0230df.62aff8", "name": "Zur Ausgabe", "links": [ "9a7ff2fe.ebd2b8" ], "x": 1975, "y": 340, "wires": [] }, { "id": "9a7ff2fe.ebd2b8", "type": "link in", "z": "6c0230df.62aff8", "name": "Zur Ausgabe", "links": [ "3ccceed0.5a744a" ], "x": 55, "y": 780, "wires": [ [ "9acd940e.345f88" ] ] }, { "id": "e1d9b043.8239d", "type": "comment", "z": "6c0230df.62aff8", "name": "Und hier kommen alle generierten Nachrichten an", "info": "", "x": 240, "y": 740, "wires": [] }, { "id": "6fc15530.2c7c3c", "type": "ui_group", "name": "Kodi", "tab": "2b3ed7f6.b24dc8", "order": 3, "disp": true, "width": 8, "collapse": false }, { "id": "2b3ed7f6.b24dc8", "type": "ui_tab", "name": "Wetter - Smarthome - Kodi", "icon": "star", "order": 1, "disabled": false, "hidden": false } ]