mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[boschindego] Add missing specialized text for unreachable device (#13058)
* Add missing specialized text for unreachable device * Document IndegoUnreachableException on relevant paths Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
949848723a
commit
f5eabf0ba2
@ -189,10 +189,11 @@ public class IndegoController {
|
||||
* @param dtoClass the DTO class to which the JSON result should be deserialized
|
||||
* @return the deserialized DTO from the JSON response
|
||||
* @throws IndegoAuthenticationException if request was rejected as unauthorized
|
||||
* @throws IndegoUnreachableException if device cannot be reached (gateway timeout error)
|
||||
* @throws IndegoException if any communication or parsing error occurred
|
||||
*/
|
||||
private <T> T getRequestWithAuthentication(String path, Class<? extends T> dtoClass)
|
||||
throws IndegoAuthenticationException, IndegoException {
|
||||
throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
|
||||
if (!session.isValid()) {
|
||||
authenticate();
|
||||
}
|
||||
@ -218,10 +219,11 @@ public class IndegoController {
|
||||
* @param dtoClass the DTO class to which the JSON result should be deserialized
|
||||
* @return the deserialized DTO from the JSON response
|
||||
* @throws IndegoAuthenticationException if request was rejected as unauthorized
|
||||
* @throws IndegoUnreachableException if device cannot be reached (gateway timeout error)
|
||||
* @throws IndegoException if any communication or parsing error occurred
|
||||
*/
|
||||
private <T> T getRequest(String path, Class<? extends T> dtoClass)
|
||||
throws IndegoAuthenticationException, IndegoException {
|
||||
throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
|
||||
try {
|
||||
Request request = httpClient.newRequest(BASE_URL + path).method(HttpMethod.GET).header(CONTEXT_HEADER_NAME,
|
||||
session.getContextId());
|
||||
@ -521,9 +523,11 @@ public class IndegoController {
|
||||
*
|
||||
* @return the device state
|
||||
* @throws IndegoAuthenticationException if request was rejected as unauthorized
|
||||
* @throws IndegoUnreachableException if device cannot be reached (gateway timeout error)
|
||||
* @throws IndegoException if any communication or parsing error occurred
|
||||
*/
|
||||
public OperatingDataResponse getOperatingData() throws IndegoAuthenticationException, IndegoException {
|
||||
public OperatingDataResponse getOperatingData()
|
||||
throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
|
||||
return getRequestWithAuthentication(SERIAL_NUMBER_SUBPATH + this.getSerialNumber() + "/operatingData",
|
||||
OperatingDataResponse.class);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import org.openhab.binding.boschindego.internal.dto.response.DeviceStateResponse
|
||||
import org.openhab.binding.boschindego.internal.dto.response.OperatingDataResponse;
|
||||
import org.openhab.binding.boschindego.internal.exceptions.IndegoAuthenticationException;
|
||||
import org.openhab.binding.boschindego.internal.exceptions.IndegoException;
|
||||
import org.openhab.binding.boschindego.internal.exceptions.IndegoUnreachableException;
|
||||
import org.openhab.core.i18n.TimeZoneProvider;
|
||||
import org.openhab.core.library.types.DateTimeType;
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
@ -145,12 +146,16 @@ public class BoschIndegoHandler extends BaseThingHandler {
|
||||
} catch (IndegoAuthenticationException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"@text/offline.comm-error.authentication-failure");
|
||||
} catch (IndegoUnreachableException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"@text/offline.comm-error.unreachable");
|
||||
} catch (IndegoException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRefreshCommand(String channelId) throws IndegoAuthenticationException, IndegoException {
|
||||
private void handleRefreshCommand(String channelId)
|
||||
throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
|
||||
switch (channelId) {
|
||||
case STATE:
|
||||
case TEXTUAL_STATE:
|
||||
@ -212,6 +217,9 @@ public class BoschIndegoHandler extends BaseThingHandler {
|
||||
} catch (IndegoAuthenticationException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"@text/offline.comm-error.authentication-failure");
|
||||
} catch (IndegoUnreachableException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"@text/offline.comm-error.unreachable");
|
||||
} catch (IndegoException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||
}
|
||||
@ -233,7 +241,8 @@ public class BoschIndegoHandler extends BaseThingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshOperatingData() throws IndegoAuthenticationException, IndegoException {
|
||||
private void refreshOperatingData()
|
||||
throws IndegoAuthenticationException, IndegoUnreachableException, IndegoException {
|
||||
updateOperatingData(controller.getOperatingData());
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user