|
[{"id":"7f5e5d39.80a1a4","type":"inject","name":"Pause","topic":"","payload":"Pause","payloadType":"string","repeat":"","crontab":"","once":false,"x":270,"y":83,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"7054285e.8fabd8","type":"inject","name":"Play","topic":"","payload":"Play","payloadType":"string","repeat":"","crontab":"","once":false,"x":400,"y":84,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"70eebedd.8f114","type":"http request","name":"description0.xml request","method":"GET","url":"","x":142.25,"y":254.00000381469727,"z":"1172eba2.ee8d14","wires":[["420e73d0.bdf18c"]]},{"id":"5f0842db.a0f7bc","type":"function","name":"set initial headers","func":"msg.action = msg.payload;\nmsg.headers = { 'User-Agent': 'SKY_skyplus'}\n\nmsg.url = \"http://\"+msg.SKYboxIP+\":49153/description0.xml\";\n\n \nreturn msg;\n\n","outputs":1,"x":373.75000762939453,"y":194.50000286102295,"z":"1172eba2.ee8d14","wires":[["70eebedd.8f114"]]},{"id":"420e73d0.bdf18c","type":"xml","name":"","x":319.25000381469727,"y":254.00000381469727,"z":"1172eba2.ee8d14","wires":[["b511caa6.4aee38"]]},{"id":"b511caa6.4aee38","type":"function","name":"get UDN","func":"var result = msg.payload;\n\nvar skyID = result['root']['device'];\n\nvar modelDescription = result.root.device[0].modelDescription[0];\nvar modelName = result.root.device[0].modelName[0];\nvar modelNumber = result.root.device[0].modelNumber[0];\nvar friendlyName = result.root.device[0].friendlyName[0];\nvar manufacturer = result.root.device[0].manufacturer[0];\nvar UDNuuid = result.root.device[0].UDN[0]\nvar UDN = UDNuuid.split(\":\")[1];\n\nmsg.UDN = UDN+\"SkyPlay\";\nmsg.payload= \"\";\n//msg.payload = modelDescription+\":\"+modelName+\":\"+modelNumber+\":\"+friendlyName+\":\"+manufacturer;\nreturn msg;","outputs":1,"x":458.25000762939453,"y":252.75000381469727,"z":"1172eba2.ee8d14","wires":[["937237b1.6c8dc8"]]},{"id":"c0fa084f.3f05f8","type":"debug","name":"","active":false,"console":"false","complete":"true","x":599,"y":446,"z":"1172eba2.ee8d14","wires":[]},{"id":"bf9d1c87.4062e","type":"http request","name":"SOAP Request","method":"POST","url":"","x":349.75000381469727,"y":316.5000047683716,"z":"1172eba2.ee8d14","wires":[["c0fa084f.3f05f8"]]},{"id":"937237b1.6c8dc8","type":"function","name":"set SOAP headers & payload","func":"// Commands for PAUSING SKY\n\nmsg.url = \"http://\"+msg.SKYboxIP+\":49153/\"+msg.UDN;\nvar speed = 1;\n\n//console.log ( msg.action );\n\nif (msg.action === \"Pause\" || msg.action === \"Stop\")\n{\nmsg.headers = { 'User-Agent': 'SKY_skyplus',\n\t\t\t\t'SOAPACTION': '\"urn:schemas-nds-com:service:SkyPlay:2#'+msg.action+'\"',\n\t\t\t\t'Content-Type': 'text/xml; char-set=utf-8' }\nmsg.payload ='<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:'+msg.action+' xmlns:u=\"urn:schemas-nds-com:service:SkyPlay:2\"><InstanceID>0</InstanceID></u:'+msg.action+'></s:Body></s:Envelope>';\n}\n\n\nif (msg.action.split(\"x\")[0] == \"REW\" || msg.action.split(\"x\")[0] == \"FF\" ) {\n\n//console.log ( msg.action.split(\"x\")[0] );\n\nvar speed = msg.action.split(\"x\")[1];\n// -30 -12 -6 -2 1 2 6 12 30\n\nif (speed > 24) {speed = 30;}\nif (speed > 9 && speed <= 24) {speed = 12;}\nif (speed > 4 && speed <= 9) {speed = 6;}\nif (speed > 1.5 && speed <= 4) {speed = 2;}\nif (speed <= 1.5) {speed = 1;}\n\nif (msg.action.split(\"x\")[0] === \"REW\" ) { speed = speed*-1;}\n\n\nmsg.action = \"Play\";\nmsg.speed = speed;\n\n}\n\n\n\n\nif (msg.action === \"Play\")\n{\nmsg.headers = { 'User-Agent': 'SKY_skyplus',\n\t\t\t\t'SOAPACTION': '\"urn:schemas-nds-com:service:SkyPlay:2#Play\"',\n\t\t\t\t'Content-Type': 'text/xml; char-set=utf-8'}\n\nmsg.payload ='<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:Play xmlns:u=\"urn:schemas-nds-com:service:SkyPlay:2\"><InstanceID>0</InstanceID><Speed>'+speed+'</Speed></u:Play></s:Body></s:Envelope>';\n}\n\n\nreturn msg;","outputs":1,"x":126,"y":318,"z":"1172eba2.ee8d14","wires":[["bf9d1c87.4062e","a41fb437.5be048"]]},{"id":"8fa2350a.705dc8","type":"inject","name":"FFx2","topic":"","payload":"FFx2","payloadType":"string","repeat":"","crontab":"","once":false,"x":250,"y":125,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"1117b7a8.eee848","type":"inject","name":"","topic":"","payload":"FFx6","payloadType":"string","repeat":"","crontab":"","once":false,"x":400,"y":124,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"a4ccf0c5.5b331","type":"inject","name":"","topic":"","payload":"FFx12","payloadType":"string","repeat":"","crontab":"","once":false,"x":532,"y":123,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"82b7753f.7d4888","type":"inject","name":"","topic":"","payload":"FFx30","payloadType":"string","repeat":"","crontab":"","once":false,"x":667,"y":123,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"89e8c869.761738","type":"inject","name":"","topic":"","payload":"REWx30","payloadType":"string","repeat":"","crontab":"","once":false,"x":88,"y":43,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"66fb9803.990468","type":"inject","name":"","topic":"","payload":"REWx12","payloadType":"string","repeat":"","crontab":"","once":false,"x":226,"y":43,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"9d910d19.626ef","type":"inject","name":"","topic":"","payload":"REWx6","payloadType":"string","repeat":"","crontab":"","once":false,"x":364,"y":42,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"b03850c8.4fc7b","type":"inject","name":"","topic":"","payload":"REWx2","payloadType":"string","repeat":"","crontab":"","once":false,"x":501,"y":42,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"a41fb437.5be048","type":"debug","name":"headercheck","active":false,"console":"false","complete":"true","x":260,"y":381,"z":"1172eba2.ee8d14","wires":[]},{"id":"ff7ac039.00854","type":"inject","name":"","topic":"","payload":"Stop","payloadType":"string","repeat":"","crontab":"","once":false,"x":120,"y":83,"z":"1172eba2.ee8d14","wires":[["62d9d43e.9d262c"]]},{"id":"62d9d43e.9d262c","type":"template","name":"Add SKYBOX IP here","field":"SKYboxIP","template":"XXX.XXX.XXX.XXX","x":130.5,"y":199,"z":"1172eba2.ee8d14","wires":[["5f0842db.a0f7bc"]]}] |
Hi, I’m new to node-red and just tried this, however I get an error on the xml request ‘no response from server’
I checked the ip of my sky box and that is correct.
Just curious looking at the age this is - does this flow still work for you ?