[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
parent
d4c9d6ef77
commit
8337f8b92d
|
@ -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())
|
||||
|
|
|
@ -69,16 +69,14 @@ 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,
|
||||
"You must define a MAC address, IP address, hostname or alias for this thing.");
|
||||
return;
|
||||
}
|
||||
this.config = config;
|
||||
updateStatus(ONLINE);
|
||||
logger.debug("Initializing the UniFi Client Handler with config = {}", config);
|
||||
if (!config.isValid()) {
|
||||
updateStatus(OFFLINE, CONFIGURATION_ERROR,
|
||||
"You must define a MAC address, IP address, hostname or alias for this thing.");
|
||||
return;
|
||||
}
|
||||
this.config = config;
|
||||
updateStatus(ONLINE);
|
||||
}
|
||||
|
||||
private static boolean belongsToSite(UniFiClient client, String siteName) {
|
||||
|
|
Loading…
Reference in New Issue