[neeo] Fixed event nullness (#10651)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2021-05-06 07:07:32 +02:00 committed by GitHub
parent e510244cb6
commit a1ebab11c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -54,8 +54,7 @@ public class NeeoDeviceChannel {
private final String label; private final String label;
/** The action/text value */ /** The action/text value */
@Nullable private final @Nullable String value; // could be either a format (text label) or a value to send (button)
private final String value; // could be either a format (text label) or a value to send (button)
/** The device channel range */ /** The device channel range */
private final NeeoDeviceChannelRange range; private final NeeoDeviceChannelRange range;
@ -236,8 +235,7 @@ public class NeeoDeviceChannel {
* *
* @return the value * @return the value
*/ */
@Nullable public @Nullable String getValue() {
public String getValue() {
return value; return value;
} }

View File

@ -251,7 +251,8 @@ public class NeeoBrainService extends DefaultServletService {
final NeeoDeviceChannel channel = device.getChannel(pathInfo.getItemName(), pathInfo.getSubType(), final NeeoDeviceChannel channel = device.getChannel(pathInfo.getItemName(), pathInfo.getSubType(),
pathInfo.getChannelNbr()); pathInfo.getChannelNbr());
if (channel != null && channel.getKind() == NeeoDeviceChannelKind.TRIGGER) { 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())); new ChannelUID(device.getUid(), channel.getItemName()));
logger.debug("Posting triggered event: {}", event); logger.debug("Posting triggered event: {}", event);
context.getEventPublisher().post(event); context.getEventPublisher().post(event);