mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[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 String thingID;
|
||||
|
||||
private String currentThingStatus = "";
|
||||
private boolean currentThingFailed = false;
|
||||
|
||||
public AndroidTVHandler(Thing thing, AndroidTVDynamicCommandDescriptionProvider commandDescriptionProvider,
|
||||
AndroidTVTranslationProvider translationProvider, ThingTypeUID thingTypeUID) {
|
||||
super(thing);
|
||||
@ -111,6 +114,9 @@ public class AndroidTVHandler extends BaseThingHandler {
|
||||
}
|
||||
|
||||
public void checkThingStatus() {
|
||||
String currentThingStatus = this.currentThingStatus;
|
||||
boolean currentThingFailed = this.currentThingFailed;
|
||||
|
||||
String statusMessage = "";
|
||||
boolean failed = false;
|
||||
|
||||
@ -133,11 +139,16 @@ public class AndroidTVHandler extends BaseThingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, statusMessage);
|
||||
} else {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
if (!currentThingStatus.equals(statusMessage) || (currentThingFailed != failed)) {
|
||||
if (failed) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, statusMessage);
|
||||
} else {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
}
|
||||
|
||||
this.currentThingStatus = statusMessage;
|
||||
this.currentThingFailed = failed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user