[tado] fix regression (#18420)

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
Andrew Fiddian-Green
2025-03-20 15:52:32 +01:00
committed by GitHub
parent 8a7504f800
commit cfd9107548
@@ -44,6 +44,7 @@ import org.openhab.core.thing.binding.ThingHandlerFactory;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
@@ -89,6 +90,13 @@ public class TadoHandlerFactory extends BaseThingHandlerFactory {
this.httpServlet = new TadoAuthenticationServlet(this);
}
@Deactivate
public void deactivate() {
if (oAuthClientService != null) {
oAuthFactory.ungetOAuthService(THING_TYPE_HOME.toString());
}
}
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
@@ -179,7 +187,6 @@ public class TadoHandlerFactory extends BaseThingHandlerFactory {
public void unsubscribeOAuthClientService(TadoHomeHandler tadoHomeHandler) {
if (oAuthClientServiceSubscribers.remove(tadoHomeHandler) && oAuthClientServiceSubscribers.isEmpty()) {
httpService.unregister(TadoAuthenticationServlet.PATH);
oAuthFactory.ungetOAuthService(THING_TYPE_HOME.toString());
}
}