Skip to content

Commit

Permalink
[HomeWizard] Process review comments (#9825)
Browse files Browse the repository at this point in the history
Processed the comments from the 3rd review.

Signed-off-by: Daniël van Os <[email protected]>
  • Loading branch information
Daniel-42 committed Mar 23, 2021
1 parent 72dc25d commit 731dd00
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 316 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.homewizard.data.P1Payload;
import org.openhab.core.io.net.http.HttpUtil;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.library.types.QuantityType;
Expand All @@ -44,12 +43,12 @@
@NonNullByDefault
public class HomeWizardHandler extends BaseThingHandler {

private HomeWizardConfiguration config = new HomeWizardConfiguration();
private @Nullable ScheduledFuture<?> pollingJob;

private final Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.create();

private HomeWizardConfiguration config = new HomeWizardConfiguration();
private @Nullable ScheduledFuture<?> pollingJob;

private String apiURL = "";
private String meterModel = "";
private int meterVersion = 0;
Expand Down Expand Up @@ -104,7 +103,7 @@ private boolean configure() {
@Override
public void dispose() {
var job = pollingJob;
if (job != null && !job.isCancelled()) {
if (job != null) {
job.cancel(true);
}
pollingJob = null;
Expand All @@ -117,9 +116,10 @@ private void pollingCode() {
final String result;

try {
result = HttpUtil.executeUrl("GET", apiURL, 750);
result = HttpUtil.executeUrl("GET", apiURL, 30000);
} catch (IOException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Unable to query P1 Meter");
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
String.format("Unable to query P1 Meter: %s", e.getMessage()));
return;
}

Expand Down
Loading

0 comments on commit 731dd00

Please sign in to comment.