Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request forbidden on type=cameras #164

Open
anoriel opened this issue Mar 8, 2018 · 0 comments
Open

Request forbidden on type=cameras #164

anoriel opened this issue Mar 8, 2018 · 0 comments

Comments

@anoriel
Copy link

anoriel commented Mar 8, 2018

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant