- Home
- Deutsch
- ioBroker Allgemein
- Adapter: ioBroker.unifi
Adapter: ioBroker.unifi
-
javascript.2 2019-08-27 17:02:52.211 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:02:52.211 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:02:52.211 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:02:52.207 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:02:52.207 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:02:52.207 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected javascript.2 2019-08-27 17:02:52.201 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:02:52.201 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:02:52.201 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:02:52.201 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:02:52.201 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: no cookies to set! javascript.2 2019-08-27 17:02:52.199 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:02:52.199 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response javascript.2 2019-08-27 17:02:51.974 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:02:51.974 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:02:51.974 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:02:51.974 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:02:51.974 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:02:51.951 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:02:51.925 info Script file script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 changed, also update in ioBroker javascript.2 2019-08-27 17:02:50.163 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:02:50.163 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:02:50.162 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:02:50.158 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:02:50.158 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:02:50.158 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: no cookies to set! javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:02:50.151 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response javascript.2 2019-08-27 17:02:49.932 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:02:49.932 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:02:49.932 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:02:49.932 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:02:49.932 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:02:49.922 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.1 2019-08-27 17:02:49.917 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.0 2019-08-27 17:02:49.909 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:02:49.907 info Script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 modified in ioBroker, write to file
-
@liv-in-sky Okay, denke ich weiß langsam wo das hinführt. Setzt bitte nochmal ein
console.log(resp);
vorconsole.log("login: got response")
-
javascript.2 2019-08-27 17:07:30.007 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:07:30.007 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:07:30.007 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:07:29.999 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:07:29.999 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:07:29.998 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected javascript.2 2019-08-27 17:07:29.993 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:07:29.993 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:07:29.993 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:07:29.993 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:07:29.992 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: no cookies to set! javascript.2 2019-08-27 17:07:29.992 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:07:29.992 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response javascript.2 2019-08-27 17:07:29.992 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: {"meta":{"rc":"ok"},"data":[]} javascript.2 2019-08-27 17:07:29.738 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:07:29.738 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:07:29.738 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:07:29.737 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:07:29.737 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:07:29.707 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:07:29.689 info Script file script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 changed, also update in ioBroker javascript.2 2019-08-27 17:07:27.950 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:07:27.950 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:07:27.950 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:07:27.946 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:07:27.946 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:07:27.945 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected javascript.2 2019-08-27 17:07:27.938 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: no cookies to set! javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response javascript.2 2019-08-27 17:07:27.937 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: {"meta":{"rc":"ok"},"data":[]} javascript.2 2019-08-27 17:07:27.698 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:07:27.698 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:07:27.698 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:07:27.698 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:07:27.698 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.1 2019-08-27 17:07:27.691 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.0 2019-08-27 17:07:27.683 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:07:27.680 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:07:27.673 info Script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 modified in ioBroker, write to file
-
@liv-in-sky Jetzt fallen mir zwei optionen ein:
setWifi ersetzten
async function setWifi(enabled) { return new Promise(async (resolve, reject) => { console.log("setWifi: start set wifi"); if(!loggedIn) { console.log("need to login"); await login().catch((e) => reject(e)); } console.log("setWifi: now setting wifi"); let resp = request.post({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, body: JSON.stringify({ _id: "", enabled }), headers: { 'Content-Type': 'application/json', Cookie: cookies.join("; ") } }).catch((e) => { console.log("setWifi: rejected: " + e); reject(e) }); console.log("setWifi: got response") if(resp != null && resp.statusCode == 200) { console.log("setWifi: Wifi wurde erfolgreich " + (enabled ? "eingeschaltet" : "ausgeschaltet")); console.log(resp); resolve(); } else { console.log("setWifi: rejetced") console.log("resp: " + JSON.stringify(resp)); reject("msg: " + JSON.parse(resp.body).meta.msg); } }); }
Wenn das nicht klappt, mal in der test funktion als erstes
await logout();
-
@thewhobox sagte in Adapter: ioBroker.unifi:
await logout();
javascript.2 2019-08-27 17:10:52.965 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:10:52.964 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:10:52.964 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:10:52.956 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:10:52.956 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:10:52.956 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected javascript.2 2019-08-27 17:10:52.948 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:10:52.948 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:10:52.948 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:10:52.948 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:10:52.948 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:10:52.947 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.g javascript.2 2019-08-27 17:10:52.947 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. javascript.2 2019-08-27 17:10:52.926 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:10:52.925 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: no cookies to set! javascript.2 2019-08-27 17:10:52.925 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:10:52.925 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response javascript.2 2019-08-27 17:10:52.925 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: {"meta":{"rc":"ok"},"data":[]} javascript.2 2019-08-27 17:10:52.706 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:10:52.705 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:10:52.685 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:10:52.663 info Script file script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 changed, also update in ioBroker javascript.2 2019-08-27 17:10:50.957 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:10:50.957 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:10:50.956 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:10:50.952 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:10:50.951 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:10:50.951 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.g javascript.2 2019-08-27 17:10:50.944 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. javascript.2 2019-08-27 17:10:50.919 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:10:50.919 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: no cookies to set! javascript.2 2019-08-27 17:10:50.919 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:10:50.919 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response javascript.2 2019-08-27 17:10:50.918 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: {"meta":{"rc":"ok"},"data":[]} javascript.2 2019-08-27 17:10:50.667 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:10:50.667 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:10:50.657 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.0 2019-08-27 17:10:50.656 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.1 2019-08-27 17:10:50.653 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:10:50.648 info Script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 modified in ioBroker, write to file
-
@liv-in-sky Hast das mit setwifi ersetzen probiert?
Hier nochmal das ganze Skript
const request = require('request-promise-native').defaults({ rejectUnauthorized: false }); const unifi_username = "user"; const unifi_password = "pass"; const unifi_controller = "https://192.168.x.xx:xxxx"; const wifi_id = "dsa4fsda6g46fdsg984"; let cookies = []; let loggedIn = false; async function login() { return new Promise(async (resolve, reject) => { let resp = await request.post({ url: unifi_controller + "/api/login", body: JSON.stringify({ username: unifi_username, password: unifi_password }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("login: reject"), reject(e) }); console.log("login: got response: " + JSON.stringify(resp)) if(resp != null) { // console.log("login: Login war erfolgreich!"); // if(resp.headers && resp.headers.hasOwnProperty("set-cookie")) { // let set_cookies = resp.headers["set-cookie"]; // console.log("set_cookies: ", typeof set_cookies); // console.log("set_cookies: ", set_cookies); // for(i = 0; i < set_cookies.length; i++) { // let cookie = set_cookies[i]; // cookie = cookie.split(";")[0]; // cookies.push(cookie); // } // console.log("login: Cookies: " + JSON.stringify(cookies)); // } else { // console.log("login: no cookies to set!") // } loggedIn = true; console.log("login: resolved") resolve(); } else { console.log("login: rejected") reject("resp = null"); } }); } async function getStatus() { return new Promise(async (resolve, reject) => { if(!loggedIn) await login().catch((e) => reject(e)); let resp = await request.get({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null && resp.statusCode == 200) { console.log("Status erfolgreich geholt!"); console.log(resp); let status = JSON.parse(resp); let wlanOn = status.data[0].enabled; console.log("WLAN ist: " + (wlanOn ? "an" : "aus")); resolve(wlanOn); } else { reject(JSON.parse(resp.body).meta.msg); } }); } async function logout() { return new Promise(async (resolve, reject) => { let resp = await request.get({ url: unifi_controller + "/logout", headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null) { console.log("Du bist nun ausgeloggt."); console.log(resp); resolve(); } else { reject("resp = null"); } }); } async function setWifi(enabled) { return new Promise(async (resolve, reject) => { console.log("setWifi: start set wifi"); if(!loggedIn) { console.log("need to login"); await login().catch((e) => reject(e)); } console.log("setWifi: now setting wifi"); let resp = request.post({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, body: JSON.stringify({ _id: "", enabled }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("setWifi: rejected: " + e); reject(e) }); console.log("setWifi: got response") if(resp != null && resp.statusCode == 200) { console.log("setWifi: Wifi wurde erfolgreich " + (enabled ? "eingeschaltet" : "ausgeschaltet")); console.log(resp); resolve(); } else { console.log("setWifi: rejetced") console.log("resp: " + JSON.stringify(resp)); reject("msg: " + JSON.parse(resp.body).meta.msg); } }); } async function test() { await logout(); console.log("starting test"); await setWifi(true).catch((e) => console.log("reject1")); console.log("getting status"); let wlan = await getStatus().catch((e) => console.log("reject2")); console.log("fin") console.log(wlan); } test()
-
mit dem ganzen script von eben
javascript.2 2019-08-27 17:16:56.397 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:16:56.397 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:16:56.397 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 javascript.2 2019-08-27 17:16:56.393 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:16:56.393 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1 javascript.2 2019-08-27 17:16:56.393 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:16:56.387 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: resp: {} javascript.2 2019-08-27 17:16:56.387 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:16:56.387 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:16:56.387 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:16:56.387 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:16:56.387 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: "{\"meta\":{\"rc\":\"ok\"},\"data\":[]}" javascript.2 2019-08-27 17:16:56.089 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:16:56.089 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:16:56.089 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:16:56.089 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.g javascript.2 2019-08-27 17:16:56.089 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. javascript.2 2019-08-27 17:16:56.069 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:16:56.069 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:16:56.047 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:16:56.024 info Script file script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 changed, also update in ioBroker javascript.2 2019-08-27 17:16:54.357 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: undefined javascript.2 2019-08-27 17:16:54.357 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: fin javascript.2 2019-08-27 17:16:54.357 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject2 javascript.2 2019-08-27 17:16:54.350 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:16:54.350 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1 javascript.2 2019-08-27 17:16:54.350 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:16:54.342 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: resp: {} javascript.2 2019-08-27 17:16:54.342 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:16:54.342 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:16:54.341 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:16:54.341 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:16:54.341 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: "{\"meta\":{\"rc\":\"ok\"},\"data\":[]}" javascript.2 2019-08-27 17:16:54.057 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:16:54.057 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:16:54.057 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:16:54.056 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.g javascript.2 2019-08-27 17:16:54.056 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. javascript.2 2019-08-27 17:16:54.037 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:16:54.037 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:16:54.025 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.1 2019-08-27 17:16:54.021 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.0 2019-08-27 17:16:54.015 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2
-
@liv-in-sky Okay danke fürs Ausprobieren. Ich weiß jetzt wo der Fehler liegt, muss aber erstmal schauen wie ich das Problem löse. Ich melde mich später nochmal
-
@thewhobox geht klar - bin eh beeindruckt, wie du das ohne testobject alles schreiben kannst
-
@liv-in-sky Ach das geht schon^^
Noch ganz kurz, was wenn du das mal probierst?
const request = require('request-promise-native').defaults({ rejectUnauthorized: false }); const unifi_username = "user"; const unifi_password = "pass"; const unifi_controller = "https://192.168.x.xx:xxxx"; const wifi_id = "dsa4fsda6g46fdsg984"; let cookies = []; let loggedIn = false; async function login() { return new Promise(async (resolve, reject) => { let resp = await request.post({ resolveWithFullResponse: true, url: unifi_controller + "/api/login", body: JSON.stringify({ username: unifi_username, password: unifi_password }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("login: reject"), reject(e) }); console.log("login: got response: " + JSON.stringify(resp)) if(resp != null) { console.log("login: Login war erfolgreich!"); if(resp.headers && resp.headers.hasOwnProperty("set-cookie")) { let set_cookies = resp.headers["set-cookie"]; console.log("set_cookies: ", typeof set_cookies); console.log("set_cookies: ", set_cookies); for(i = 0; i < set_cookies.length; i++) { let cookie = set_cookies[i]; cookie = cookie.split(";")[0]; cookies.push(cookie); } console.log("login: Cookies: " + JSON.stringify(cookies)); } else { console.log("login: no cookies to set!") } loggedIn = true; console.log("login: resolved") resolve(); } else { console.log("login: rejected") reject("resp = null"); } }); } async function getStatus() { return new Promise(async (resolve, reject) => { if(!loggedIn) await login().catch((e) => reject(e)); let resp = await request.get({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null && resp.statusCode == 200) { console.log("Status erfolgreich geholt!"); console.log(resp); let status = JSON.parse(resp); let wlanOn = status.data[0].enabled; console.log("WLAN ist: " + (wlanOn ? "an" : "aus")); resolve(wlanOn); } else { reject(JSON.parse(resp.body).meta.msg); } }); } async function logout() { return new Promise(async (resolve, reject) => { let resp = await request.get({ url: unifi_controller + "/logout", headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null) { console.log("Du bist nun ausgeloggt."); console.log(resp); resolve(); } else { reject("resp = null"); } }); } async function setWifi(enabled) { return new Promise(async (resolve, reject) => { console.log("setWifi: start set wifi"); if(!loggedIn) { console.log("need to login"); await login().catch((e) => reject(e)); } console.log("setWifi: now setting wifi"); let resp = request.post({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, body: JSON.stringify({ _id: "", enabled }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("setWifi: rejected: " + e); reject(e) }); console.log("setWifi: got response") if(resp != null && resp.statusCode == 200) { console.log("setWifi: Wifi wurde erfolgreich " + (enabled ? "eingeschaltet" : "ausgeschaltet")); console.log(resp); resolve(); } else { console.log("setWifi: rejetced") console.log("resp: " + JSON.stringify(resp)); reject("msg: " + JSON.parse(resp.body).meta.msg); } }); } async function test() { await logout(); console.log("starting test"); await setWifi(true).catch((e) => console.log("reject1")); console.log("getting status"); let wlan = await getStatus().catch((e) => console.log("reject2")); console.log("fin") console.log(wlan); } test()
-
frage : sollte der aufruf getStatus(); noch funktionieren oder müßte man auch einen anderen aufruf machen - das ging ja schon mal aber jetzt nicht mehr
javascript.2 2019-08-27 17:27:36.644 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:27:36.644 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1 javascript.2 2019-08-27 17:27:36.644 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:27:36.639 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: resp: {} javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Cookies: ["unifises=7Eqk0YywPeNtHf5nKKMdWmNAqRhSyR8Q","csrf_token=HlhrzcVRNkyp4CpUYN2pRQAvYzwK6p6U"] javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:27:36.638 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: {"statusCode":200,"body":"{\"meta\":{\"rc\":\"ok\"},\"data\":[]}","headers":{"vary":"Origin","access-control-allow-credentials":"true javascript.2 2019-08-27 17:27:36.376 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:27:36.376 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:27:36.376 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:27:36.376 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.g javascript.2 2019-08-27 17:27:36.376 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. javascript.2 2019-08-27 17:27:36.356 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:27:36.355 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:27:36.326 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:27:36.308 info Script file script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 changed, also update in ioBroker javascript.2 2019-08-27 17:27:34.580 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status javascript.2 2019-08-27 17:27:34.580 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1 javascript.2 2019-08-27 17:27:34.580 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: resp: {} javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Cookies: ["unifises=3qzciQyP04QRdIr9SC4MbgTL5c1fukGH","csrf_token=YHgpqCYp6XK2hDHth01oMxtsWJQaHnnj"] javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: javascript.2 2019-08-27 17:27:34.574 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! javascript.2 2019-08-27 17:27:34.573 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: {"statusCode":200,"body":"{\"meta\":{\"rc\":\"ok\"},\"data\":[]}","headers":{"vary":"Origin","access-control-allow-credentials":"true javascript.2 2019-08-27 17:27:34.333 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login javascript.2 2019-08-27 17:27:34.333 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi javascript.2 2019-08-27 17:27:34.333 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test javascript.2 2019-08-27 17:27:34.332 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.g javascript.2 2019-08-27 17:27:34.332 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. javascript.2 2019-08-27 17:27:34.313 info script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules javascript.2 2019-08-27 17:27:34.313 info Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.0 2019-08-27 17:27:34.308 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.2 2019-08-27 17:27:34.300 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 javascript.1 2019-08-27 17:27:34.296 info Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 js2fs.0 2019-08-27 17:27:34.291 info Script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 modified in ioBroker, write to file
das log ist mit deinem neuen file - ohne getStatus() - war nur eine frage
-
@liv-in-sky sagte in Adapter: ioBroker.unifi:
login: got response: {"statusCode":200,"body":"{\
Könntest du davon mir die komplette Zeile schicken?
Also momentan funktioniert das speichern des Cookies nicht, deswegen geht getStatus und setWifi nicht.
-
javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: {"statusCode":200,"body":"{\"meta\":{\"rc\":\"ok\"},\"data\":[]}","headers":{"vary":"Origin","access-control-allow-credentials":"true","access-control-expose-headers":"Access-Control-Allow-Origin,Access-Control-Allow-Credentials","set-cookie":["unifises=7Eqk0YywPeNtHf5nKKMdWmNAqRhSyR8Q; Path=/; Secure; HttpOnly","csrf_token=HlhrzcVRNkyp4CpUYN2pRQAvYzwK6p6U; Path=/; Secure"],"x-frame-options":"DENY","content-type":"application/json;charset=UTF-8","content-length":"30","date":"Tue, 27 Aug 2019 15:27:36 GMT","connection":"close"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"192.168.178.157:8443","port":"8443","hostname":"192.168.178.157","hash":null,"search":null,"query":null,"pathname":"/api/login","path":"/api/login","href":"https://192.168.178.157:8443/api/login"},"method":"POST","headers":{"Content-Type":"application/json","content-length":40}}}
alles
17:37:35.460 info javascript.2 Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 17:37:36.896 info javascript.2 Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 17:37:36.896 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules 17:37:36.918 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: Du bist nun ausgeloggt. 17:37:36.918 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: <!DOCTYPE html><html lang="en" ng-controller="ManageController as manageCtrl" ng-strict-di><head><meta charset="utf-8"><title ng-bind="manageCtrl.system.getName() || manageCtrl.system.getHostname() || 'UniFi Network'">UniFi Network</title><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" unifi-prevent-focus-zoom><meta name="apple-itunes-app" content="app-id=1057750338"><base href="/manage/"><link rel="apple-touch-icon-precomposed" href="images/favicons/favicon-152.png?v=2"><meta name="msapplication-TileColor" content="#0193d7"><meta name="msapplication-TileImage" content="images/favicons/favicon-144.png?v=2"><link rel="apple-touch-icon-precomposed" sizes="152x152" href="images/favicons/favicon-152.png?v=2"><link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/favicons/favicon-144.png?v=2"><link rel="apple-touch-icon-precomposed" sizes="120x120" href="images/favicons/favicon-120.png?v=2"><link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/favicons/favicon-72.png?v=2"><link rel="apple-touch-icon-precomposed" href="images/favicons/favicon-57.png?v=2"><link rel="icon" href="images/favicons/favicon-32.png?v=2" sizes="32x32"><script src="config/config.v5.11.39.0.js"></script><script type="text/javascript">window.unifiConfig.version = '5.11.39.0'; </script><script src="js/initial.v5.11.39.0.js"></script><script src="js/components.v5.11.39.0.js" defer></script><script src="js/base.v5.11.39.0.js" defer></script><script src="js/main.manage.v5.11.39.0.js" defer></script><style>.whiteout{position:fixed;top:0;right:0;bottom:0;left:0;z-index:30;display:flex;flex-direction:column;justify-content:center;align-items:center}.type-word-break{word-break:break-all}[ng-cloak]{display:none}.app{visibility:hidden}*,*:before,*:after{-webkit-box-sizing:border-box;box-sizing:border-box}html,body{font-size:14px !important}body{font-family:"Lato", "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;font-weight:400;height:100%;background:#ffffff;color:#000000;line-height:1}div{display:block}.mt-3{margin-top:12px !important}.mb-3{margin-bottom:12px !important}.stackCenter{display:flex;flex-direction:column;align-items:center}.ubntStatusBar{background-color:#d6d9e2;display:inline-block;height:2px;width:100%}.ubntStatusBar--success{--status-bar-color: #39cc64}.ubntStatusBar__status{background-color:#006fff;display:block;height:100%}.appSpinner.appSpinner--medium{background-size:cover;width:3.5714285714rem;height:3.5714285714rem} </style><link href="fonts/5.11.39.0/ubnt-icon/style.css" rel="stylesheet" media="none" onload="if(media!=='all') media='all'"><link href="css/styles.bundle.v5.11.39.0.css" rel="stylesheet" media="none" onload="if(media!=='all') media='all'"><link href="css/app.v5.11.39.0.css" rel="stylesheet" media="none" onload="if(media!=='all') media='all'"><link href="https://chrome.google.com/webstore/detail/hmpigflbjeapnknladcfphgkemopofig" rel="chrome-webstore-item"><link href="fonts/5.11.39.0/aura/fonts.css" rel="stylesheet" media="none" onload="if(media!=='all') media='all'"></head><body aura-theme><svg class="pos-absolute" height="0" width="0"><defs><linearGradient id="experienceGraphGradient" x1="0" y1="0" x2="0" y2="100%" patternUnits="userSpaceOnUse"><stop offset="0%" stop-color="#0046cc" stop-opacity="0.3"></stop><stop offset="100%" stop-color="#ffffff" stop-opacity="0"></stop></linearGradient></defs></svg><route-status route-status-fatal-state="manageCtrl.ENV.FATAL_STATE" route-status-immediate="manageCtrl.site.isSiteChanging"><unifi-connection-status></unifi-connection-status></route-status><div class="app" unifi-bowser ng-cloak><unifi-key-events></unifi-key-events><!--[if lte IE 9]><div class="appOutdatedBrowserWarning is-warning-visible ubntToastContainer"><![endif]--><!--[if gt IE 9]><!--><div class="appOutdatedBrowserWarning ubntToastContainer"><!--<![endif]--><div class="ubntToast"><div class="ubntToast__image"><div class="ubntIconContainer ubntIconContainer--round ubntIconContainer--danger"><div class="type-larger ubnt-icon--alert" style="margin-top: -4px;"></div></div></div><div class="ubntToast__body"><div class="ubntToast__title">Outdated Browser</div><div class="ubntToast__details">You are using an <strong>outdated</strong> browser. Please <a href='http://browsehappy.com/' class='ubntLink'>upgrade your browser</a> to improve your experience.</div></div></div></div><div class="ubntToastContainer" hey-toaster unifi-position-alerts><div class="ubntToast" ng-class="{'is-child-dropdown-expanded': dropdownVisible}"><div class="ubntToast__image appAlertIcon" style="display: flex;" ng-if="::toast.message.icon" ng-class="::[toast.message.icon, { 'primary': toast.level === 'primary' || toast.level === 'default', 'success': toast.level === 'success', 'warning': toast.level === 'warning', 'danger': toast.level === 'danger' }]"></div><div class="ubntToast__image" ng-if="::!toast.message.icon"><div class="ubntIconContainer ubntIconContainer--round" ng-class="::{ 'ubntIconContainer--primary': toast.level === 'primary' || toast.level === 'default', 'ubntIconContainer--success': toast.level === 'success', 'ubntIconContainer--warning': toast.level === 'warning', 'ubntIconContainer--danger': toast.level === 'danger' }" ng-init="icon = ((toast.level === 'primary' || toast.level === 'default') && 'bell' || toast.level === 'danger' && 'close' || toast.level)"><unifi-aura-icon unifi-aura-icon="::icon" unifi-aura-icon-class="['ubntIcon']"></unifi-aura-icon></div></div><div class="ubntToast__close"><div class="ubntIcon ubntIcon--actionable ubntIcon--transparent iconText__icon ubnt-icon--x-circle" ng-click="toast.close()"></div></div><div class="ubntToast__body"><div class="ubntToast__title" ng-if="::toast.message.title">{{::toast.message.title}}</div><div class="ubntToast__details">{{::toast.message.text || toast.message | decodeHtml}}</div><div class="ubntToast__actions ubntButtonGroup ubntButtonGroup--cozy" ng-if="::toast.message.primary || toast.message.secondary"><button class="ubntButton ubntButton--link" ng-if="toast.message.secondary" type="button" ng-click="toast.message.secondary.callback();toast.close()"><span class="button__icon icon" ng-class="::toast.message.secondary.icon"></span><span>{{::toast.message.secondary.label}}</span></button><button class="ubntButton ubntButton--link" ng-if="toast.message.primary && !toast.message.primary.actions" type="button" ng-click="toast.message.primary.callback();toast.close()"><span class="button__icon icon" ng-class="::toast.message.primary.icon ? toast.message.primary.icon : 'ubnt-icon--check-2'"></span><span>{{::toast.message.primary.label}}</span></button><button class="ubntSelect ubntSelect--link" ng-if="toast.message.primary && toast.message.primary.actions" type="button" ng-click="$parent.$parent.dropdownVisible = !$parent.$parent.dropdownVisible;"> {{::toast.message.primary.label}}</button></div><div class="ubntToast__dropdown" ng-if="::toast.message.primary && toast.message.primary.actions"><div class="ubntDropdown"><a class="ubntDropdown__item" ng-repeat="item in ::toast.message.primary.actions" ng-click="item.callback(toast)">{{::item.label}}</a></div></div></div></div></div><ui-view></ui-view><unifi-debug-panel></unifi-debug-panel><div class="unifiModalLayoutContainer"><unifi-blackout-modal unifi-blackout-modal-layout="addClientLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="autoChannelsModalLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="addDpiCategoryGraphLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="addSiteLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="addSshKeyLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="cloudAccess2faTokenLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="cloudAccessUserLayout" unifi-blackout-modal-reject-on-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="cloudKeySdCardCheckLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="configureMapsLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="confirmLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="dashboardFormLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="deviceUlteSetupLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="discoveryToolChromeRequiredLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="discoveryToolInstallLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="discoveryToolPortAlreadyInUseLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="dpiRestrictionFormLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="dpiRestrictionGroupFormLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="dpiRestrictionNetworkAssignmentFormLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="editAccountLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="adminPasswordChangeSuggestionLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="editMapLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="exportSiteLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="eliteDeviceOfflineLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="firewallGroupsCreateLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="fallbackVlanLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="hotspot2NaiRealmListEntryLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="hotspotPackageLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="importSiteLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="ipsSuppressionFormLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="ipsWhitelistFormLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="instantRmaLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="ipsThreatDetailLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="ispThroughputLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="preferencesLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="radiusProfileLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="reportClientFingerprintLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="simpleTextEditorLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="sitesOverviewLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="speedTestLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="statisticsDpiFiltersLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="systemConfigLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="reportTermsOfServiceLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="trainingLoginLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="webrtcErrorLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="webrtcFailedLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="wirelessNetworkMacFilterAddBatchLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="wirelessNetworkMacFilterAddClientsLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="wirelessUplinkDfsWarningLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="workingLayout"></unifi-blackout-modal><unifi-blackout-modal unifi-blackout-modal-layout="webrtcReconnectingLayout" unifi-blackout-modal-disable-esc="true"></unifi-blackout-modal><unifi-app-takeover unifi-app-takeover-layout="whatsNewTakeoverLayout" unifi-app-takeover-show-header="true"></unifi-app-takeover></div></div><!-- Native app loading status--></body></html> 17:37:36.918 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test 17:37:36.918 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi 17:37:36.918 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: {"statusCode":200,"body":"{\"meta\":{\"rc\":\"ok\"},\"data\":[]}","headers":{"vary":"Origin","access-control-allow-credentials":"true","access-control-expose-headers":"Access-Control-Allow-Origin,Access-Control-Allow-Credentials","set-cookie":["unifises=UxCIewm8sjQjyecfzvUm4dfDNbrsE2d5; Path=/; Secure; HttpOnly","csrf_token=uN8KhbamMmCoPo1GpgnK94JEBQQJRGZf; Path=/; Secure"],"x-frame-options":"DENY","content-type":"application/json;charset=UTF-8","content-length":"30","date":"Tue, 27 Aug 2019 15:37:36 GMT","connection":"close"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"192.168.178.157:8443","port":"8443","hostname":"192.168.178.157","hash":null,"search":null,"query":null,"pathname":"/api/login","path":"/api/login","href":"https://192.168.178.157:8443/api/login"},"method":"POST","headers":{"Content-Type":"application/json","content-length":40}}} 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Cookies: ["unifises=UxCIewm8sjQjyecfzvUm4dfDNbrsE2d5","csrf_token=uN8KhbamMmCoPo1GpgnK94JEBQQJRGZf"] 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response 17:37:37.194 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced 17:37:37.195 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: resp: {} 17:37:37.200 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected: StatusCodeError: 401 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.LoginRequired\"},\"data\":[]}" 17:37:37.200 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1 17:37:37.200 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status
-
@thewhobox auch auf die gefahr das dies lächerlich ist
ich habe mal das unifi.js file von nodered geholt - kannst du damit etwas anfangen - damit soll man auch wifi disablen und enablen können - zeile 1171 wird auch wlan ein-ausgeschalten
unifi.js.txt -
@thewhobox
@liv-in-sky
so, jetzt bin ich zu Hause. Jetzt kann ich Euch kaum folgen. Soll ich was helfen/testen ? -
@dslraser
ich glaub im moment ist pausedas ist das aktuelle script: achtung in der ersten zeile hat sich auch etwas verändert - vor dem user setting
const request = require('request-promise-native').defaults({ rejectUnauthorized: false }); const unifi_username = "user"; const unifi_password = "pass"; const unifi_controller = "https://192.168.x.xx:xxxx"; const wifi_id = "dsa4fsda6g46fdsg984"; let cookies = []; let loggedIn = false; async function login() { return new Promise(async (resolve, reject) => { let resp = await request.post({ url: unifi_controller + "/api/login", body: JSON.stringify({ username: unifi_username, password: unifi_password }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("login: reject"), reject(e) }); console.log("login: got response: " + JSON.stringify(resp)) if(resp != null) { // console.log("login: Login war erfolgreich!"); // if(resp.headers && resp.headers.hasOwnProperty("set-cookie")) { // let set_cookies = resp.headers["set-cookie"]; // console.log("set_cookies: ", typeof set_cookies); // console.log("set_cookies: ", set_cookies); // for(i = 0; i < set_cookies.length; i++) { // let cookie = set_cookies[i]; // cookie = cookie.split(";")[0]; // cookies.push(cookie); // } // console.log("login: Cookies: " + JSON.stringify(cookies)); // } else { // console.log("login: no cookies to set!") // } loggedIn = true; console.log("login: resolved") resolve(); } else { console.log("login: rejected") reject("resp = null"); } }); } async function getStatus() { return new Promise(async (resolve, reject) => { if(!loggedIn) await login().catch((e) => reject(e)); let resp = await request.get({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null && resp.statusCode == 200) { console.log("Status erfolgreich geholt!"); console.log(resp); let status = JSON.parse(resp); let wlanOn = status.data[0].enabled; console.log("WLAN ist: " + (wlanOn ? "an" : "aus")); resolve(wlanOn); } else { reject(JSON.parse(resp.body).meta.msg); } }); } async function logout() { return new Promise(async (resolve, reject) => { let resp = await request.get({ url: unifi_controller + "/logout", headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null) { console.log("Du bist nun ausgeloggt."); console.log(resp); resolve(); } else { reject("resp = null"); } }); } async function setWifi(enabled) { return new Promise(async (resolve, reject) => { console.log("setWifi: start set wifi"); if(!loggedIn) { console.log("need to login"); await login().catch((e) => reject(e)); } console.log("setWifi: now setting wifi"); let resp = request.post({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, body: JSON.stringify({ _id: "", enabled }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("setWifi: rejected: " + e); reject(e) }); console.log("setWifi: got response") if(resp != null && resp.statusCode == 200) { console.log("setWifi: Wifi wurde erfolgreich " + (enabled ? "eingeschaltet" : "ausgeschaltet")); console.log(resp); resolve(); } else { console.log("setWifi: rejetced") console.log("resp: " + JSON.stringify(resp)); reject("msg: " + JSON.parse(resp.body).meta.msg); } }); } async function test() { await logout(); console.log("starting test"); await setWifi(true).catch((e) => console.log("reject1")); console.log("getting status"); let wlan = await getStatus().catch((e) => console.log("reject2")); console.log("fin") console.log(wlan); } test()
-
@thewhobox
würd gern was sinnvolles beitragen, deshalb noch ein amateur versuch etwas beizusteuernhab mal die antworten des bash scriptes und deines scriptes verglichen - schaut irgendwie anders aus
-
@liv-in-sky ja das macht jede Bibliothek beim empfangen der Daten anders.
-
Guten Morgen,
hier nochmal das ganze Skript:
const request = require('request-promise-native').defaults({ rejectUnauthorized: false }); const unifi_username = "user"; const unifi_password = "pass"; const unifi_controller = "https://192.168.x.xx:xxxx"; const wifi_id = "dsa4fsda6g46fdsg984"; let cookies = []; let loggedIn = false; async function login() { return new Promise(async (resolve, reject) => { let resp = await request.post({ resolveWithFullResponse: true, url: unifi_controller + "/api/login", body: JSON.stringify({ username: unifi_username, password: unifi_password }), headers: { 'Content-Type': 'application/json' } }).catch((e) => { console.log("login: reject"), reject(e) }); console.log("login: got response: " + JSON.stringify(resp)) if(resp != null) { console.log("login: Login war erfolgreich!"); if(resp.headers && resp.headers.hasOwnProperty("set-cookie")) { let set_cookies = resp.headers["set-cookie"]; console.log("set_cookies: ", typeof set_cookies); console.log("set_cookies: ", set_cookies); for(i = 0; i < set_cookies.length; i++) { let cookie = set_cookies[i]; cookie = cookie.split(";")[0]; cookies.push(cookie); } console.log("login: Cookies: " + JSON.stringify(cookies)); } else { console.log("login: no cookies to set!") } loggedIn = true; console.log("login: resolved") resolve(); } else { console.log("login: rejected") reject("resp = null"); } }); } async function getStatus() { return new Promise(async (resolve, reject) => { if(!loggedIn) await login().catch((e) => reject(e)); let resp = await request.get({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null && resp.statusCode == 200) { console.log("Status erfolgreich geholt!"); console.log(resp); let status = JSON.parse(resp); let wlanOn = status.data[0].enabled; console.log("WLAN ist: " + (wlanOn ? "an" : "aus")); resolve(wlanOn); } else { reject(JSON.parse(resp.body).meta.msg); } }); } async function logout() { return new Promise(async (resolve, reject) => { let resp = await request.get({ url: unifi_controller + "/logout", headers: { Cookie: cookies.join("; ") } }).catch((e) => reject(e)); if(resp != null) { console.log("Du bist nun ausgeloggt."); console.log(resp); resolve(); } else { reject("resp = null"); } }); } async function setWifi(enabled) { return new Promise(async (resolve, reject) => { console.log("setWifi: start set wifi"); if(!loggedIn) { console.log("need to login"); await login().catch((e) => reject(e)); } console.log("setWifi: now setting wifi"); let resp = request.post({ url: unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, body: JSON.stringify({ _id: "", enabled }), headers: { 'Content-Type': 'application/json', Cookie: cookies.join("; ") } }).catch((e) => { console.log("setWifi: rejected: " + e); reject(e) }); console.log("setWifi: got response") if(resp != null && resp.statusCode == 200) { console.log("setWifi: Wifi wurde erfolgreich " + (enabled ? "eingeschaltet" : "ausgeschaltet")); console.log(resp); resolve(); } else { console.log("setWifi: rejetced") console.log("resp: " + JSON.stringify(resp)); reject("msg: " + JSON.parse(resp.body).meta.msg); } }); } async function test() { console.log("starting test"); await setWifi(true).catch((e) => console.log("reject1: " + e)); console.log("getting status"); let wlan = await getStatus().catch((e) => console.log("reject2: " + e)); console.log("fin") console.log(wlan); } test()
-
@thewhobox auch einen guten morgen
und hier das log:
09:21:26.481 info javascript.2 Stop script script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 09:21:34.242 info javascript.2 Start javascript script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2 09:21:34.242 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: starting test 09:21:34.242 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: start set wifi 09:21:34.242 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: need to login 09:21:34.242 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: registered 0 subscriptions and 0 schedules 09:21:34.536 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: got response: {"statusCode":200,"body":"{\"meta\":{\"rc\":\"ok\"},\"data\":[]}","headers":{"vary":"Origin","access-control-allow-credentials":"true","access-control-expose-headers":"Access-Control-Allow-Origin,Access-Control-Allow-Credentials","set-cookie":["unifises=rUTs0tMWpm4QcxFH1cvV5VuWIYCV4UhY; Path=/; Secure; HttpOnly","csrf_token=lE7GdlIBf0bhQS4qJcaowM1F4iGmc2lk; Path=/; Secure"],"x-frame-options":"DENY","content-type":"application/json;charset=UTF-8","content-length":"30","date":"Wed, 28 Aug 2019 07:21:34 GMT","connection":"close"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"192.168.178.157:8443","port":"8443","hostname":"192.168.178.157","hash":null,"search":null,"query":null,"pathname":"/api/login","path":"/api/login","href":"https://192.168.178.157:8443/api/login"},"method":"POST","headers":{"Content-Type":"application/json","content-length":40}}} 09:21:34.536 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Login war erfolgreich! 09:21:34.536 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: 09:21:34.536 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: set_cookies: 09:21:34.537 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: Cookies: ["unifises=rUTs0tMWpm4QcxFH1cvV5VuWIYCV4UhY","csrf_token=lE7GdlIBf0bhQS4qJcaowM1F4iGmc2lk"] 09:21:34.537 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: login: resolved 09:21:34.537 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: now setting wifi 09:21:34.537 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: got response 09:21:34.537 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejetced 09:21:34.537 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: resp: {} 09:21:34.549 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: setWifi: rejected: StatusCodeError: 400 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.IdInvalid\"},\"data\":[]}" 09:21:34.549 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: reject1: StatusCodeError: 400 - "{\"meta\":{\"rc\":\"error\",\"msg\":\"api.err.IdInvalid\"},\"data\":[]}" 09:21:34.549 info javascript.2 script.js.Armin_Schalter.ALLERLEI.UnifiWLAN2: getting status