Skip to content

Commit

Permalink
[openwebnet] Replace scheduleAtFixedRate by scheduleWithFixedDelay (#…
Browse files Browse the repository at this point in the history
…10822)

- fixed some other spotless issues

Signed-off-by: Conte Andrea <andrea@conte.com>
  • Loading branch information
aconte80 committed Jun 12, 2021
1 parent e452de8 commit fc66615
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public class OpenWebNetEnergyHandler extends OpenWebNetThingHandler {

private final Logger logger = LoggerFactory.getLogger(OpenWebNetEnergyHandler.class);

public final static Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES;
public final int ENERGY_SUBSCRIPTION_PERIOD = 10; // minutes
public static final Set<ThingTypeUID> 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) {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {

private final Logger logger = LoggerFactory.getLogger(OpenWebNetThermoregulationHandler.class);

public final static Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES;
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES;

private boolean isTempSensor = false; // is the device a sensor or thermostat?

Expand Down

0 comments on commit fc66615

Please sign in to comment.