]> git.basschouten.com Git - openhab-addons.git/commitdiff
[neeo] Fixed event nullness (#10651)
authorChristoph Weitkamp <github@christophweitkamp.de>
Thu, 6 May 2021 05:07:32 +0000 (07:07 +0200)
committerGitHub <noreply@github.com>
Thu, 6 May 2021 05:07:32 +0000 (07:07 +0200)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/models/NeeoDeviceChannel.java
bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/servletservices/NeeoBrainService.java

index 2338d49c0e96bde51992739c47932366cd740ef1..9b4cd7a362ff504b7580b5afb030c93017abff5b 100644 (file)
@@ -54,8 +54,7 @@ public class NeeoDeviceChannel {
     private final String label;
 
     /** The action/text value */
-    @Nullable
-    private final String value; // could be either a format (text label) or a value to send (button)
+    private final @Nullable String value; // could be either a format (text label) or a value to send (button)
 
     /** The device channel range */
     private final NeeoDeviceChannelRange range;
@@ -236,8 +235,7 @@ public class NeeoDeviceChannel {
      *
      * @return the value
      */
-    @Nullable
-    public String getValue() {
+    public @Nullable String getValue() {
         return value;
     }
 
index 75a24602653bf01794e89332d1ce2ed9bac16229..e47bdff91e62cd4f261fd0d0fb7a2fa418704fdb 100644 (file)
@@ -251,7 +251,8 @@ public class NeeoBrainService extends DefaultServletService {
             final NeeoDeviceChannel channel = device.getChannel(pathInfo.getItemName(), pathInfo.getSubType(),
                     pathInfo.getChannelNbr());
             if (channel != null && channel.getKind() == NeeoDeviceChannelKind.TRIGGER) {
-                final ChannelTriggeredEvent event = ThingEventFactory.createTriggerEvent(channel.getValue(),
+                String value = channel.getValue();
+                final ChannelTriggeredEvent event = ThingEventFactory.createTriggerEvent(value == null ? "" : value,
                         new ChannelUID(device.getUid(), channel.getItemName()));
                 logger.debug("Posting triggered event: {}", event);
                 context.getEventPublisher().post(event);