private List<VizioApp> userConfigApps = new ArrayList<>();
private Object sequenceLock = new Object();
+ private int failCount = 0;
private int pairingDeviceId = -1;
private int pairingToken = -1;
private Long currentInputHash = 0L;
}
}
updateStatus(ThingStatus.ONLINE);
+ failCount = 0;
} catch (VizioException e) {
logger.debug("Unable to retrieve Vizio TV power mode info. Exception: {}", e.getMessage(), e);
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-get-power");
+ // A communication error must occur 3 times before updating the thing status
+ failCount++;
+ if (failCount > 2) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
+ "@text/offline.communication-error-polling");
+ }
+ return;
}
if (powerOn && (isLinked(VOLUME) || isLinked(MUTE))) {
} catch (VizioException e) {
logger.debug("Unable to retrieve Vizio TV current audio settings. Exception: {}", e.getMessage(),
e);
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-get-audio");
}
}
}
} catch (VizioException e) {
logger.debug("Unable to retrieve Vizio TV current input. Exception: {}", e.getMessage(), e);
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-get-input");
}
}
}
} catch (VizioException e) {
logger.debug("Unable to retrieve Vizio TV current running app. Exception: {}", e.getMessage(), e);
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-get-app");
}
}
}
powerOn = false;
}
} catch (VizioException e) {
- logger.debug("Unable to send power {} command to the Vizio TV, Exception: {}", command,
+ logger.warn("Unable to send power {} command to the Vizio TV, Exception: {}", command,
e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-set-power");
}
}
break;
.changeVolume(String.format(MODIFY_INT_SETTING_JSON, volume, currentVolumeHash));
currentVolumeHash = 0L;
} catch (VizioException e) {
- logger.debug("Unable to set volume on the Vizio TV, command volume: {}, Exception: {}",
+ logger.warn("Unable to set volume on the Vizio TV, command volume: {}, Exception: {}",
command, e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-set-volume");
} catch (NumberFormatException e) {
- logger.debug("Unable to parse command volume value {} as int", command);
+ logger.warn("Unable to parse command volume value {} as int", command);
}
}
break;
currentMute = false;
}
} catch (VizioException e) {
- logger.debug("Unable to send mute {} command to the Vizio TV, Exception: {}", command,
+ logger.warn("Unable to send mute {} command to the Vizio TV, Exception: {}", command,
e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-set-mute");
}
}
break;
.changeInput(String.format(MODIFY_STRING_SETTING_JSON, command, currentInputHash));
currentInputHash = 0L;
} catch (VizioException e) {
- logger.debug("Unable to set current source on the Vizio TV, source: {}, Exception: {}",
+ logger.warn("Unable to set current source on the Vizio TV, source: {}, Exception: {}",
command, e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-set-source");
}
}
break;
if (selectedApp.isPresent()) {
communicator.launchApp(selectedApp.get().getConfig());
} else {
- logger.debug("Unknown app name: '{}', check that it exists in App List configuration",
+ logger.warn("Unknown app name: '{}', check that it exists in App List configuration",
command);
}
} catch (VizioException e) {
- logger.debug("Unable to launch app name: '{}' on the Vizio TV, Exception: {}", command,
+ logger.warn("Unable to launch app name: '{}' on the Vizio TV, Exception: {}", command,
e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-launch-app");
}
}
break;
try {
handleControlCommand(command);
} catch (VizioException e) {
- logger.debug("Unable to send control command: '{}' to the Vizio TV, Exception: {}", command,
+ logger.warn("Unable to send control command: '{}' to the Vizio TV, Exception: {}", command,
e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-send-cmd");
}
}
break;
KeyCommand keyCommand = KeyCommand.valueOf(command.toString().toUpperCase(Locale.ENGLISH));
communicator.sendKeyPress(keyCommand.getJson());
} catch (IllegalArgumentException | VizioException e) {
- logger.debug("Unable to send keypress to the Vizio TV, key: {}, Exception: {}", command,
+ logger.warn("Unable to send keypress to the Vizio TV, key: {}, Exception: {}", command,
e.getMessage());
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
- "@text/offline.communication-error-send-key");
}
}
break;