[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,6 +139,7 @@ public class AndroidTVHandler extends BaseThingHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if (!currentThingStatus.equals(statusMessage) || (currentThingFailed != failed)) {
|
||||
if (failed) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, statusMessage);
|
||||
} else {
|
||||
|
@ -140,6 +147,10 @@ public class AndroidTVHandler extends BaseThingHandler {
|
|||
}
|
||||
}
|
||||
|
||||
this.currentThingStatus = statusMessage;
|
||||
this.currentThingFailed = failed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "@text/offline.protocols-starting");
|
||||
|
|
Loading…
Reference in New Issue