diff --git a/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/handler/EcowattHandler.java b/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/handler/EcowattHandler.java index c6fd16e6b06..e29d69ea34a 100644 --- a/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/handler/EcowattHandler.java +++ b/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/handler/EcowattHandler.java @@ -118,10 +118,7 @@ public class EcowattHandler extends BaseThingHandler { @Override public void handleRemoval() { - EcowattRestApi localApi = api; - if (localApi != null) { - localApi.deleteServiceAndAccessToken(); - } + oAuthFactory.deleteServiceAndAccessToken(thing.getUID().getAsString()); super.handleRemoval(); } diff --git a/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/restapi/EcowattRestApi.java b/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/restapi/EcowattRestApi.java index c7f8d01fe4f..7da333721b3 100644 --- a/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/restapi/EcowattRestApi.java +++ b/bundles/org.openhab.binding.ecowatt/src/main/java/org/openhab/binding/ecowatt/internal/restapi/EcowattRestApi.java @@ -140,8 +140,4 @@ public class EcowattRestApi { public void dispose() { oAuthFactory.ungetOAuthService(authServiceHandle); } - - public void deleteServiceAndAccessToken() { - oAuthFactory.deleteServiceAndAccessToken(authServiceHandle); - } }