From: Dan Cunningham Date: Fri, 16 Dec 2022 07:31:02 +0000 (-0800) Subject: [hydrawise] fixes null pointer error for some sprinkler controllers (#13965) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=ab504bc69e27e11bb8f7effe0b6cecb21ab90c14;p=openhab-addons.git [hydrawise] fixes null pointer error for some sprinkler controllers (#13965) Signed-off-by: Dan Cunningham --- diff --git a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java index 0bbd87d9ea..5e3060ed75 100644 --- a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java +++ b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java @@ -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 zones) {