Skip to content

Commit

Permalink
Merge pull request #13 from docbender/3.4.x
Browse files Browse the repository at this point in the history
Fix command only channel
  • Loading branch information
docbender authored Mar 5, 2023
2 parents 8422005 + ed5c12e commit 3941d14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
@NonNullByDefault
public class SimpleBinaryBindingConstants {
public static final String VERSION = "3.4.0";
public static final String VERSION = "3.4.1";

private static final String BINDING_ID = "simplebinary";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void updateConfig() {
commandItems.add(ch);
if (!devices.containsKey(ch.getCommandAddress().getDeviceId())) {
devices.put(ch.getCommandAddress().getDeviceId(),
new SimpleBinaryDevice(ch.getStateAddress().getDeviceId()).addThingHandler(h));
new SimpleBinaryDevice(ch.getCommandAddress().getDeviceId()).addThingHandler(h));
} else {
devices.get(ch.getCommandAddress().getDeviceId()).addThingHandler(h);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ public void handleCommand(ChannelUID channelUID, Command command) {
connection.sendData(channel, command);
}

@Override
public void handleRemoval() {
super.handleRemoval();
}

@Override
public void updateState(ChannelUID channelUID, State state) {
super.updateState(channelUID, state);
Expand All @@ -223,13 +228,16 @@ public void setError(String message) {
errorSetTime = System.currentTimeMillis();
var st = getThing().getStatusInfo();
if (st.getStatus() == ThingStatus.OFFLINE && st.getStatusDetail() == ThingStatusDetail.COMMUNICATION_ERROR
&& message.equals(st.getDescription())) {
&& st.getDescription() != null && message.equals(st.getDescription())) {
return;
}

updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, message);
}

/**
* Clear thing error if necessary
*/
public void clearError() {
// no error
if (getThing().getStatus() == ThingStatus.ONLINE) {
Expand Down

0 comments on commit 3941d14

Please sign in to comment.