iobroker-community-adapters / ioBroker.unifi

ioBroker.unifi is an ioBroker adapter for your UniFi network devices.
MIT License
71 stars 23 forks source link

[updateUnifiData-login site undefined] error: timeout of 5000ms exceeded #709

Closed nevermind2001 closed 11 months ago

nevermind2001 commented 1 year ago

Since maybe a few weeks i have the following error in my iobroker log. after this error happens, the adapter stops working which means, that the datapoints are not updated anymore, for example is_online or last_seen (which i use for presence). The instance is still green.

After a restart it worked again until the error occurs again.

2023-10-19 05:17:57.608 - error: unifi.0 (1116221) [updateUnifiData-login site undefined] error: timeout of 5000ms exceeded, stack: AxiosError: timeout of 5000ms exceeded
at RedirectableRequest.handleRequestTimeout (/opt/iobroker/node_modules/node-unifi/node_modules/axios/lib/adapters/http.js:628:16)
at RedirectableRequest.emit (node:events:513:28)
at RedirectableRequest.emit (node:domain:489:12)
at Timeout. (/opt/iobroker/node_modules/follow-redirects/index.js:169:12)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7)

grafik

(is_online has to be false^^)

Yesterday i updated my Unifi-Controller to 7.5.187 but the error was also on the previous Controller Version.

ar7bd commented 11 months ago

Seeing the same issue. It looks like the timeout has been introduced by node-unifi version 2.4.1: https://github.com/jens-maus/node-unifi/commit/8ccb7523110962dd928a3fb39d60502c3a8e0d0d

The updated node-unifi is part of ioBroker.unifi 0.6.5: https://github.com/iobroker-community-adapters/ioBroker.unifi/commit/5da321c74411e18239d723c34d7677ba7d61a641

The adapter should probably identify the timeout and trigger an update anyway.

Changing line 265 (and following) in main.js to the following code works for me (warning: this is not a recommended patch, since it will hammer the target in case of a login failure):

try {
    await defaultController.login();
} catch (err) {
    this.handleError(err, undefined, 'updateUnifiData-login');

    this.queryTimeout = setTimeout(() => {
        this.updateUnifiData();
    }, this.settings.updateInterval);

    return;
}
Ilovegym66 commented 11 months ago

with V3.2.5 on UDM Pro the login is with the adapter not possible any more.. any ideas? The change above is not working here.

jens-maus commented 11 months ago

with V3.2.5 on UDM Pro the login is with the adapter not possible any more.. any ideas? The change above is not working here.

If 3.2.5 is not working with node-unifi, please report your issue there, This is nothing that have to be handled in ioBroker.unifi separately. However, please note that v3.2.5 is still a beta version known to have severe issues as it seems (https://ubiquiti-networks-forum.de/board/thread/8516-unifi-os-3-2-5-ein-totaler-flopp/?postID=103950).