empierre / MyDomoAtHome

MyDomoAtHome - REST interface for ImperoHome with Domoticz (ISS)
http://domoticz.com/wiki/ImperiHome
GNU General Public License v3.0
32 stars 22 forks source link

Request forbidden on type=cameras #164

Open anoriel opened 6 years ago

anoriel commented 6 years ago

Hi everyone,

I tried to add another instance of MDAH with a Domoticz user with only some devices. It seems that this user can't access to json.html?type=cameras with a 403 http error so I have update his own instance file mdah.js with this :

function DevCamera() { var url = getURL() + "?type=cameras&rid="; var res = requester('GET', url); if(res.statusCode == 403){ return []; } var data = JSON.parse(res.body.toString('utf-8')); var combo = []; if (typeof data.result !== 'undefined' && data.result !== null) { for (var i = 0; i < data.result.length; i++) { var myfeed = {"id": "C"+i, "name": data.result[i].Name, "type": "DevCamera", "room": "Switches"}; var params = []; params.push({"key": "localjpegurl", "value": data.result[i].ImageURL}); myfeed.params = params; combo.push(myfeed); } } return (combo); };

The lines added are :

if(res.statusCode == 403){ return []; }

If anyone have another solution...