From 2b6661c4f2b3953b1d5a5a1797317e6a1a8bc8f5 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 9 Nov 2016 08:44:07 +0000 Subject: [PATCH] Test for broken XML in WeMo response (#250) Thanks @hardillb --- hardware/wemo/lib/wemo.js | 92 +++++++++++++++++++------------------- hardware/wemo/package.json | 2 +- 2 files changed, 48 insertions(+), 46 deletions(-) diff --git a/hardware/wemo/lib/wemo.js b/hardware/wemo/lib/wemo.js index 3de09768..c6d68fda 100644 --- a/hardware/wemo/lib/wemo.js +++ b/hardware/wemo/lib/wemo.js @@ -100,59 +100,61 @@ WeMoNG.prototype.start = function start() { res.on('end',function() { xml2js.parseString(data, function(err, result) { if(!err) { - var list = result["s:Envelope"]["s:Body"][0]["u:GetEndDevicesResponse"][0].DeviceLists[0]; - xml2js.parseString(list, function(err, result2) { - if (!err) { - var devinfo = result2.DeviceLists.DeviceList[0].DeviceInfos[0].DeviceInfo; - for (var i=0; i