]> git.basschouten.com Git - openhab-addons.git/commitdiff
[hydrawise] fixes null pointer error for some sprinkler controllers (#13965)
authorDan Cunningham <dan@digitaldan.com>
Fri, 16 Dec 2022 07:31:02 +0000 (23:31 -0800)
committerGitHub <noreply@github.com>
Fri, 16 Dec 2022 07:31:02 +0000 (08:31 +0100)
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java

index 0bbd87d9ea9a19618275421b29dd1daeed9a9a98..5e3060ed75ccdf20a507e7f645ac78e16c4b1578 100644 (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) {