ioBroker.unifi
ioBroker.unifi copied to clipboard
Reconnect WiFi client #466 (reopened because of stall)
Describe the idea by @Tranquility76 Hi,
in the Unifi App and Webinterface you have the option to reconnect a WiFi client initiated by the AP. This is useful if you have IoT devices that sometime hangup in the WiFi connection. (can be recognized if the "experience" value of the client goes down)
If you press "reconnect" the AP drops the connection of the client and the client reconnects and everything is fine. I would like to automated this "reconnect", but the adapter is missing this functionality.
https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#335 Line 335 describes the desired function. Can this possibly be done with node-unifi and a javascript-script by now?
I think it would be a very useful feature for many users. I will use it.
Es war möglich mit diesem Skript. Leider kriege ich seit neuestem einen 403er dazu.
`const Unifi = require('node-unifi'); const unifi = new Unifi.Controller({host: '192.168.178.1', port: '443', sslverify: false});
var macID;
on({id: "0_userdata.0.vis.ReconnectNetworkDevices.macID"/macID/, change: "ne"}, async function (obj) { console.log('Ausgelöst'); //console.log(obj.state ? obj.state.val : ""); var value = obj.state.val; var oldValue = obj.oldState.val; if ((obj.state ? obj.state.val : "") != '') { await reconnectMacID(value); } setStateDelayed('0_userdata.0.vis.ReconnectNetworkDevices.macID', '', false, parseInt(((5000) || "").toString(), 10), false); });
function reconnectMacID(macID) { (async () => { try { // LOGIN const loginData = await unifi.login('user', 'password'); console.log('login: ' + loginData);
// GET SITE STATS
const reconnect = await unifi.reconnectClient(macID);
console.log('Reconnect: ' + reconnect);
console.log(JSON.stringify(reconnect));
// LOGOUT
const logoutData = await unifi.logout();
console.log('logout: ' + JSON.stringify(logoutData));
} catch (error) { console.log('ERROR: ' + error); } })(); }
`
I think the issue can be closed #597