Skip to content

Commit

Permalink
fix: changes 4 code-review
Browse files Browse the repository at this point in the history
Signed-off-by: tischober <t.schober@outlook.de>
  • Loading branch information
tischober committed May 7, 2024
1 parent 2fd523c commit 0cd8545
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional

Check failure on line 3 in bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/emt7110/Emt7110ReadingConverter.java

View workflow job for this annotation

GitHub Actions / Build (Java 17, ubuntu-22.04)

Header line doesn't match pattern ^ \*$
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.jeelink.internal.emt7110;
Expand All @@ -16,8 +13,6 @@
import java.util.regex.Pattern;

import org.openhab.binding.jeelink.internal.JeeLinkReadingConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Handler for a EMT7110 energy Sensor thing.
Expand All @@ -28,8 +23,6 @@ public class Emt7110ReadingConverter implements JeeLinkReadingConverter<Emt7110R
private static final Pattern READING_P = Pattern.compile(
"OK EMT7110\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)");

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

@Override
public Emt7110Reading createReading(String inputLine) {
// parse lines only if we have registered listeners
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional

Check failure on line 3 in bundles/org.openhab.binding.jeelink/src/main/java/org/openhab/binding/jeelink/internal/emt7110/Emt7110SensorHandler.java

View workflow job for this annotation

GitHub Actions / Build (Java 17, ubuntu-22.04)

Header line doesn't match pattern ^ \*$
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.jeelink.internal.emt7110;

import static org.openhab.binding.jeelink.internal.JeeLinkBindingConstants.*;

import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicInteger;

import org.openhab.binding.jeelink.internal.JeeLinkHandler;
import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
import org.openhab.binding.jeelink.internal.ReadingPublisher;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
Expand All @@ -36,11 +28,6 @@
*/
public class Emt7110SensorHandler extends JeeLinkSensorHandler<Emt7110Reading> {
private final Logger logger = LoggerFactory.getLogger(Emt7110SensorHandler.class);
private OnOffType state;
private JeeLinkHandler bridge;
private final AtomicInteger channel = new AtomicInteger(-1);

private ScheduledFuture<?> retry;

public Emt7110SensorHandler(Thing thing, String sensorType) {
super(thing, sensorType);
Expand All @@ -55,15 +42,12 @@ public Class<Emt7110Reading> getReadingClass() {
public void initialize() {
super.initialize();

bridge = (JeeLinkHandler) getBridge().getHandler();

logger.debug("initilized handler for thing {} ({})}", getThing().getLabel(), getThing().getUID().getId());
}

@Override
public void dispose() {
super.dispose();
cancelRetry();
}

@Override
Expand Down Expand Up @@ -91,12 +75,4 @@ public void dispose() {
}
};
}

private void cancelRetry() {
ScheduledFuture<?> retry = this.retry;
if (retry != null) {
retry.cancel(true);
retry = null;
}
}
}

0 comments on commit 0cd8545

Please sign in to comment.