[androidtv] Fix log flood when physical device is not online (#15258)
* Fixes log flood when physical device is not online --------- Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
This commit is contained in:
parent
0beaada48c
commit
16816e3e7a
|
@ -65,6 +65,9 @@ public class AndroidTVHandler extends BaseThingHandler {
|
||||||
private final ThingTypeUID thingTypeUID;
|
private final ThingTypeUID thingTypeUID;
|
||||||
private final String thingID;
|
private final String thingID;
|
||||||
|
|
||||||
|
private String currentThingStatus = "";
|
||||||
|
private boolean currentThingFailed = false;
|
||||||
|
|
||||||
public AndroidTVHandler(Thing thing, AndroidTVDynamicCommandDescriptionProvider commandDescriptionProvider,
|
public AndroidTVHandler(Thing thing, AndroidTVDynamicCommandDescriptionProvider commandDescriptionProvider,
|
||||||
AndroidTVTranslationProvider translationProvider, ThingTypeUID thingTypeUID) {
|
AndroidTVTranslationProvider translationProvider, ThingTypeUID thingTypeUID) {
|
||||||
super(thing);
|
super(thing);
|
||||||
|
@ -111,6 +114,9 @@ public class AndroidTVHandler extends BaseThingHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkThingStatus() {
|
public void checkThingStatus() {
|
||||||
|
String currentThingStatus = this.currentThingStatus;
|
||||||
|
boolean currentThingFailed = this.currentThingFailed;
|
||||||
|
|
||||||
String statusMessage = "";
|
String statusMessage = "";
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
|
|
||||||
|
@ -133,11 +139,16 @@ public class AndroidTVHandler extends BaseThingHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed) {
|
if (!currentThingStatus.equals(statusMessage) || (currentThingFailed != failed)) {
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, statusMessage);
|
if (failed) {
|
||||||
} else {
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, statusMessage);
|
||||||
updateStatus(ThingStatus.ONLINE);
|
} else {
|
||||||
|
updateStatus(ThingStatus.ONLINE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.currentThingStatus = statusMessage;
|
||||||
|
this.currentThingFailed = failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue