mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[fronius] Fix connection check with Gen24 inverters (#9120)
2.5.x Backport of PR #9108 Fix #8633 Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
parent
3174ff8663
commit
ed798b7ad7
@ -13,7 +13,6 @@
|
|||||||
package org.openhab.binding.fronius.internal.handler;
|
package org.openhab.binding.fronius.internal.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
@ -26,6 +25,7 @@ import org.eclipse.smarthome.core.thing.ThingStatus;
|
|||||||
import org.eclipse.smarthome.core.thing.ThingStatusDetail;
|
import org.eclipse.smarthome.core.thing.ThingStatusDetail;
|
||||||
import org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler;
|
import org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler;
|
||||||
import org.eclipse.smarthome.core.types.Command;
|
import org.eclipse.smarthome.core.types.Command;
|
||||||
|
import org.eclipse.smarthome.io.net.http.HttpUtil;
|
||||||
import org.openhab.binding.fronius.internal.FroniusBridgeConfiguration;
|
import org.openhab.binding.fronius.internal.FroniusBridgeConfiguration;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -94,14 +94,11 @@ public class FroniusBridgeHandler extends BaseBridgeHandler {
|
|||||||
Runnable runnable = () -> {
|
Runnable runnable = () -> {
|
||||||
boolean online = false;
|
boolean online = false;
|
||||||
try {
|
try {
|
||||||
InetAddress inet;
|
if (HttpUtil.executeUrl("GET", "http://" + config.hostname, 5000) != null) {
|
||||||
inet = InetAddress.getByName(config.hostname);
|
|
||||||
if (inet.isReachable(5000)) {
|
|
||||||
online = true;
|
online = true;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.debug("Connection Error: {}", e.getMessage());
|
logger.debug("Connection Error: {}", e.getMessage());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!online) {
|
if (!online) {
|
||||||
|
Loading…
Reference in New Issue
Block a user