Skip to content

Commit

Permalink
Check command address when command is handled
Browse files Browse the repository at this point in the history
  • Loading branch information
docbender committed Nov 9, 2020
1 parent f15c5d9 commit 513ab6d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ public void handleCommand(ChannelUID channelUID, Command command) {
}
SimaticChannel channel = channels.get(channelUID);

if (channel.getCommandAddress() == null) {
logger.warn("{} - command not completed. Channel does not have a command address specified. ChannelUID={}",
thing.getLabel(), channelUID);
return;
}

connection.sendData(channel, command);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,14 @@ protected void reconnectWithDelaying() {
/**
* Send command into device channel
*
* @see org.openhab.binding.SimaticIDevice.internal.SimaticIDevice#sendData(java.lang.String,
* org.openhab.core.types.Command)
*/
@Override
public void sendData(SimaticChannel item, Command command) {
try {
var area = SimaticWriteDataArea.create(command, item, pduSize, charset);
sendData(area);
} catch (Exception ex) {
logger.error("{} - ", toString(), ex);
logger.error("{} - ChannelUID={}. {}.", toString(), item.channelId, ex.getMessage(), ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@NonNullByDefault
public class SimaticBindingConstants {

public static final String VERSION = "3.0.0";
public static final String VERSION = "3.0.1";

private static final String BINDING_ID = "simatic";

Expand Down

0 comments on commit 513ab6d

Please sign in to comment.