[hydrawise] fixes null pointer error for some sprinkler controllers (#13965)

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
pull/13966/head
Dan Cunningham 2022-12-15 23:31:02 -08:00 committed by GitHub
parent 15ad22b5ad
commit ab504bc69e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -258,8 +258,7 @@ public class HydrawiseControllerHandler extends BaseThingHandler implements Hydr
// update values with what the cloud tells us even though the controller may be offline
if (!controller.status.online) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
String.format("Controller Offline: %s last seen %s", controller.status.summary,
secondsToDateTime(controller.status.lastContact.timestamp)));
"Service reports controller as offline");
} else if (getThing().getStatus() != ThingStatus.ONLINE) {
updateStatus(ThingStatus.ONLINE);
}
@ -277,7 +276,8 @@ public class HydrawiseControllerHandler extends BaseThingHandler implements Hydr
updateGroupState(CHANNEL_GROUP_CONTROLLER_SYSTEM, CHANNEL_CONTROLLER_SUMMARY,
new StringType(controller.status.summary));
updateGroupState(CHANNEL_GROUP_CONTROLLER_SYSTEM, CHANNEL_CONTROLLER_LAST_CONTACT,
secondsToDateTime(controller.status.lastContact.timestamp));
controller.status.lastContact != null ? secondsToDateTime(controller.status.lastContact.timestamp)
: UnDefType.NULL);
}
private void updateZones(List<Zone> zones) {