From fc66615fce11f6c043f252a42dcd97cfd5deb78f Mon Sep 17 00:00:00 2001 From: Conte Andrea Date: Sat, 12 Jun 2021 12:32:00 +0200 Subject: [PATCH] [openwebnet] Replace scheduleAtFixedRate by scheduleWithFixedDelay (#10822) - fixed some other spotless issues Signed-off-by: Conte Andrea --- .../openwebnet/handler/OpenWebNetEnergyHandler.java | 11 ++++++----- .../handler/OpenWebNetThermoregulationHandler.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetEnergyHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetEnergyHandler.java index dc41ae596c46..f9771bf19f84 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetEnergyHandler.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetEnergyHandler.java @@ -56,8 +56,8 @@ public class OpenWebNetEnergyHandler extends OpenWebNetThingHandler { private final Logger logger = LoggerFactory.getLogger(OpenWebNetEnergyHandler.class); - public final static Set SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES; - public final int ENERGY_SUBSCRIPTION_PERIOD = 10; // minutes + public static final Set SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES; + public static final int ENERGY_SUBSCRIPTION_PERIOD = 10; // minutes private @Nullable ScheduledFuture notificationSchedule; public OpenWebNetEnergyHandler(Thing thing) { @@ -98,7 +98,7 @@ public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { } private void subscribeToActivePowerChanges() { - notificationSchedule = scheduler.scheduleAtFixedRate(() -> { + notificationSchedule = scheduler.scheduleWithFixedDelay(() -> { if (isFirstSchedulerLaunch) { logger.debug( "subscribeToActivePowerChanges() For WHERE={} subscribing to active power changes notification for the next {}min", @@ -182,11 +182,12 @@ protected void handleMessage(BaseOpenMessage msg) { return; } else { // fix: check for correct DIM (ActivePower / 113) - if (msg.getDim().equals(DIM.ACTIVE_POWER)) + if (msg.getDim().equals(DIM.ACTIVE_POWER)) { updateActivePower(msg); - else + } else { logger.debug("handleMessage() Ignoring message {} because it's not related to active power value.", msg); + } } } diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThermoregulationHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThermoregulationHandler.java index 01a16d3aacb1..7d8ae06de193 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThermoregulationHandler.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThermoregulationHandler.java @@ -53,7 +53,7 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler { private final Logger logger = LoggerFactory.getLogger(OpenWebNetThermoregulationHandler.class); - public final static Set SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES; + public static final Set SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES; private boolean isTempSensor = false; // is the device a sensor or thermostat?