mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-02-04 03:14:07 +01:00
Fix thing action backwards compatibility (#16212)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
d434fc5e4e
commit
af63083bdf
@ -46,6 +46,27 @@ public class PushoverActions implements ThingActions {
|
|||||||
|
|
||||||
private @NonNullByDefault({}) PushoverAccountHandler accountHandler;
|
private @NonNullByDefault({}) PushoverAccountHandler accountHandler;
|
||||||
|
|
||||||
|
@RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription")
|
||||||
|
public @ActionOutput(name = "sent", label = "@text/sendMessageActionOutputLabel", description = "@text/sendMessageActionOutputDescription", type = "java.lang.Boolean") Boolean sendMessage(
|
||||||
|
@ActionInput(name = "message", label = "@text/sendMessageActionInputMessageLabel", description = "@text/sendMessageActionInputMessageDescription", type = "java.lang.String", required = true) String message,
|
||||||
|
@ActionInput(name = "title", label = "@text/sendMessageActionInputTitleLabel", description = "@text/sendMessageActionInputTitleDescription", type = "java.lang.String", defaultValue = DEFAULT_TITLE) @Nullable String title,
|
||||||
|
@ActionInput(name = "sound", label = "@text/sendMessageActionInputSoundLabel", description = "@text/sendMessageActionInputSoundDescription", type = "java.lang.String", defaultValue = DEFAULT_SOUND) @Nullable String sound,
|
||||||
|
@ActionInput(name = "url", label = "@text/sendMessageActionInputURLLabel", description = "@text/sendMessageActionInputURLDescription", type = "java.lang.String") @Nullable String url,
|
||||||
|
@ActionInput(name = "urlTitle", label = "@text/sendMessageActionInputURLTitleLabel", description = "@text/sendMessageActionInputURLTitleDescription", type = "java.lang.String") @Nullable String urlTitle,
|
||||||
|
@ActionInput(name = "attachment", label = "@text/sendMessageActionInputAttachmentLabel", description = "@text/sendMessageActionInputAttachmentDescription", type = "java.lang.String") @Nullable String attachment,
|
||||||
|
@ActionInput(name = "contentType", label = "@text/sendMessageActionInputContentTypeLabel", description = "@text/sendMessageActionInputContentTypeDescription", type = "java.lang.String", defaultValue = DEFAULT_CONTENT_TYPE) @Nullable String contentType,
|
||||||
|
@ActionInput(name = "priority", label = "@text/sendMessageActionInputPriorityLabel", description = "@text/sendMessageActionInputPriorityDescription", type = "java.lang.Integer", defaultValue = DEFAULT_EMERGENCY_PRIORITY) @Nullable Integer priority,
|
||||||
|
@ActionInput(name = "device", label = "@text/sendMessageActionInputDeviceLabel", description = "@text/sendMessageActionInputDeviceDescription", type = "java.lang.String") @Nullable String device) {
|
||||||
|
return sendMessage(message, title, sound, url, urlTitle, attachment, contentType, priority, device, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean sendMessage(ThingActions actions, String message, @Nullable String title,
|
||||||
|
@Nullable String sound, @Nullable String url, @Nullable String urlTitle, @Nullable String attachment,
|
||||||
|
@Nullable String contentType, @Nullable Integer priority, @Nullable String device) {
|
||||||
|
return ((PushoverActions) actions).sendMessage(message, title, sound, url, urlTitle, attachment, contentType,
|
||||||
|
priority, device);
|
||||||
|
}
|
||||||
|
|
||||||
@RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription")
|
@RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription")
|
||||||
public @ActionOutput(name = "sent", label = "@text/sendMessageActionOutputLabel", description = "@text/sendMessageActionOutputDescription", type = "java.lang.Boolean") Boolean sendMessage(
|
public @ActionOutput(name = "sent", label = "@text/sendMessageActionOutputLabel", description = "@text/sendMessageActionOutputDescription", type = "java.lang.Boolean") Boolean sendMessage(
|
||||||
@ActionInput(name = "message", label = "@text/sendMessageActionInputMessageLabel", description = "@text/sendMessageActionInputMessageDescription", type = "java.lang.String", required = true) String message,
|
@ActionInput(name = "message", label = "@text/sendMessageActionInputMessageLabel", description = "@text/sendMessageActionInputMessageDescription", type = "java.lang.String", required = true) String message,
|
||||||
@ -59,8 +80,8 @@ public class PushoverActions implements ThingActions {
|
|||||||
@ActionInput(name = "device", label = "@text/sendMessageActionInputDeviceLabel", description = "@text/sendMessageActionInputDeviceDescription", type = "java.lang.String") @Nullable String device,
|
@ActionInput(name = "device", label = "@text/sendMessageActionInputDeviceLabel", description = "@text/sendMessageActionInputDeviceDescription", type = "java.lang.String") @Nullable String device,
|
||||||
@ActionInput(name = "ttl", label = "@text/sendMessageActionInputTTLLabel", description = "@text/sendMessageActionInputTTLDescription", type = "java.time.Duration") @Nullable Duration ttl) {
|
@ActionInput(name = "ttl", label = "@text/sendMessageActionInputTTLLabel", description = "@text/sendMessageActionInputTTLDescription", type = "java.time.Duration") @Nullable Duration ttl) {
|
||||||
logger.trace(
|
logger.trace(
|
||||||
"ThingAction 'sendMessage' called with value(s): message='{}', title='{}', sound='{}', url='{}', urlTitle='{}', attachment='{}', contentType='{}', priority='{}', device='{}'",
|
"ThingAction 'sendMessage' called with value(s): message='{}', title='{}', sound='{}', url='{}', urlTitle='{}', attachment='{}', contentType='{}', priority='{}', device='{}', ttl='{}'",
|
||||||
message, title, sound, url, urlTitle, attachment, contentType, priority, device);
|
message, title, sound, url, urlTitle, attachment, contentType, priority, device, ttl);
|
||||||
|
|
||||||
PushoverMessageBuilder builder = getDefaultPushoverMessageBuilder(message);
|
PushoverMessageBuilder builder = getDefaultPushoverMessageBuilder(message);
|
||||||
// add sound, if defined
|
// add sound, if defined
|
||||||
|
Loading…
Reference in New Issue
Block a user