Skip to content

Commit

Permalink
[smsmodem] Small fixes
Browse files Browse the repository at this point in the history
update channel
rename action to avoid colision with other binding and a too generic name

Signed-off-by: Gwendal Roulleau <[email protected]>
  • Loading branch information
dalgwen committed Mar 7, 2022
1 parent 87c12f9 commit 73714e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bundles/org.openhab.binding.smsmodem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Where uid is the Bridge UID of the *smsconversation* thing.
Once this action instance is retrieved, you can invoke the 'send' method on it:

```
smsAction.send("1234567890", "Hello world!")
smsAction.sendSMS("1234567890", "Hello world!")
```

## Full Example
Expand All @@ -102,7 +102,7 @@ when
Item Alarm changed
then
val smsAction = getActions("smsmodem","smsmodem:smsmodembridge:dongleuid")
smsAction.send("33123456789", "Alert !")
smsAction.sendSMS("33123456789", "Alert !")
end
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void setThingHandler(@Nullable ThingHandler handler) {
}

@RuleAction(label = "Send Message", description = "Send a message")
public void send(
public void sendSMS(
@ActionInput(name = "recipient", label = "recipient", description = "Recipient of the message") @Nullable String recipient,
@ActionInput(name = "message", label = "message", description = "Message to send") @Nullable String message) {
if (recipient != null && !recipient.isEmpty() && message != null) {
Expand All @@ -57,9 +57,9 @@ public void send(
}
}

public static void send(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String message) {
public static void sendSMS(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String message) {
if (actions instanceof SMSModemActions) {
((SMSModemActions) actions).send(recipient, message);
((SMSModemActions) actions).sendSMS(recipient, message);
} else {
throw new IllegalArgumentException("Instance is not an SMSModemActions class.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void handleCommand(ChannelUID channelUID, Command command) {
}
if (channelUID.getId().equals(SMSModemBindingConstants.CHANNEL_SEND)) {
send(command.toString());
updateState(SMSModemBindingConstants.CHANNEL_SEND, new StringType(command.toString()));
}
}

Expand Down

0 comments on commit 73714e7

Please sign in to comment.