[unifi] Fix thing configuration reload after changes (#11411)

* Fix config reload after changes.

Fixes #11407

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Don't try to initialize client when bridge is offline.

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
pull/11433/head
jlaur 2021-10-23 00:05:16 +02:00 committed by GitHub
parent d4c9d6ef77
commit 8337f8b92d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -59,6 +59,7 @@ public abstract class UniFiBaseThingHandler<E, C> extends BaseThingHandler {
}
if (bridge.getStatus() == OFFLINE) {
updateStatus(OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE, "The UniFi Controller is currently offline.");
return;
}
// mgb: derive the config class from the generic type
Class<?> clazz = (Class<?>) (((ParameterizedType) getClass().getGenericSuperclass())

View File

@ -69,7 +69,6 @@ public class UniFiClientThingHandler extends UniFiBaseThingHandler<UniFiClient,
@Override
protected synchronized void initialize(UniFiClientThingConfig config) {
// mgb: called when the config changes
if (thing.getStatus() == INITIALIZING) {
logger.debug("Initializing the UniFi Client Handler with config = {}", config);
if (!config.isValid()) {
updateStatus(OFFLINE, CONFIGURATION_ERROR,
@ -79,7 +78,6 @@ public class UniFiClientThingHandler extends UniFiBaseThingHandler<UniFiClient,
this.config = config;
updateStatus(ONLINE);
}
}
private static boolean belongsToSite(UniFiClient client, String siteName) {
boolean result = true; // mgb: assume true = proof by contradiction