mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
fix offline when image not available (#18066)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This commit is contained in:
parent
ffa2d1722d
commit
5ac2780749
@ -365,13 +365,19 @@ public class SpeedtestHandler extends BaseThingHandler {
|
|||||||
isp = tmpCont.getIsp();
|
isp = tmpCont.getIsp();
|
||||||
interfaceInternalIp = tmpCont.getInterface().getInternalIp();
|
interfaceInternalIp = tmpCont.getInterface().getInternalIp();
|
||||||
interfaceExternalIp = tmpCont.getInterface().getExternalIp();
|
interfaceExternalIp = tmpCont.getInterface().getExternalIp();
|
||||||
resultUrl = tmpCont.getResult().getUrl();
|
if (tmpCont.getResult().isPersisted()) {
|
||||||
String url = String.valueOf(resultUrl) + ".png";
|
resultUrl = tmpCont.getResult().getUrl();
|
||||||
logger.debug("Downloading result image from: {}", url);
|
String url = String.valueOf(resultUrl) + ".png";
|
||||||
RawType image = HttpUtil.downloadImage(url);
|
logger.debug("Downloading result image from: {}", url);
|
||||||
if (image != null) {
|
RawType image = HttpUtil.downloadImage(url);
|
||||||
resultImage = image;
|
if (image != null) {
|
||||||
|
resultImage = image;
|
||||||
|
} else {
|
||||||
|
resultImage = UnDefType.NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
logger.debug("Result image not persisted");
|
||||||
|
resultUrl = "";
|
||||||
resultImage = UnDefType.NULL;
|
resultImage = UnDefType.NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +263,9 @@ public class ResultContainer {
|
|||||||
@SerializedName("url")
|
@SerializedName("url")
|
||||||
@Expose
|
@Expose
|
||||||
private String url;
|
private String url;
|
||||||
|
@SerializedName("persisted")
|
||||||
|
@Expose
|
||||||
|
private boolean persisted;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -279,6 +282,14 @@ public class ResultContainer {
|
|||||||
public void setUrl(String url) {
|
public void setUrl(String url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPersisted() {
|
||||||
|
return persisted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPersisted(boolean persisted) {
|
||||||
|
this.persisted = persisted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Server {
|
public class Server {
|
||||||
|
Loading…
Reference in New Issue
Block a user