mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[groupepsa] Remove the access token when the thing is removed (#14943)
Related to #14818 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
5d65507584
commit
3ae72c92e5
@ -13,7 +13,6 @@
|
||||
package org.openhab.binding.groupepsa.internal.bridge;
|
||||
|
||||
import static org.openhab.binding.groupepsa.internal.GroupePSABindingConstants.THING_TYPE_BRIDGE;
|
||||
import static org.openhab.binding.groupepsa.internal.GroupePSABindingConstants.VendorConstants;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@ -26,6 +25,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.openhab.binding.groupepsa.internal.GroupePSABindingConstants.VendorConstants;
|
||||
import org.openhab.binding.groupepsa.internal.discovery.GroupePSADiscoveryService;
|
||||
import org.openhab.binding.groupepsa.internal.rest.api.GroupePSAConnectApi;
|
||||
import org.openhab.binding.groupepsa.internal.rest.api.dto.Vehicle;
|
||||
@ -94,7 +94,10 @@ public class GroupePSABridgeHandler extends BaseBridgeHandler {
|
||||
@Override
|
||||
public void dispose() {
|
||||
stopGroupePSABridgePolling();
|
||||
oAuthFactory.ungetOAuthService(thing.getUID().getAsString());
|
||||
if (oAuthService != null) {
|
||||
oAuthFactory.ungetOAuthService(thing.getUID().getAsString());
|
||||
oAuthService = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,6 +141,14 @@ public class GroupePSABridgeHandler extends BaseBridgeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRemoval() {
|
||||
if (oAuthService != null) {
|
||||
oAuthFactory.deleteServiceAndAccessToken(thing.getUID().getAsString());
|
||||
}
|
||||
super.handleRemoval();
|
||||
}
|
||||
|
||||
private void startGroupePSABridgePolling(@Nullable Integer pollingIntervalM) {
|
||||
if (groupepsaBridgePollingJob == null) {
|
||||
final long pollingIntervalToUse = pollingIntervalM == null ? DEFAULT_POLLING_INTERVAL_M : pollingIntervalM;
|
||||
|
Loading…
Reference in New Issue
Block a user