Skip to content

Commit 089b415

Browse files
authored
[pushover] Add support for Expiring Messages (openhab#15289)
* Add support for Expiring Messages * Add action variants with TTL parameter Resolves openhab#15288 --------- Signed-off-by: Jacob Laursen <[email protected]>
1 parent 7d63504 commit 089b415

File tree

6 files changed

+257
-18
lines changed

6 files changed

+257
-18
lines changed

bundles/org.openhab.binding.pushover/README.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,34 @@ The parameter `message` is **mandatory**, the `title` parameter defaults to what
4040
Parameters declared as `@Nullable` are not optional.
4141
One has to pass a `null` value if it should be skipped or the default value for it should be used.
4242

43-
- `sendMessage(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)` - This method is used to send a plain text message providing all available parameters.
43+
- `sendMessage(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, @Nullable Duration ttl)` - This method is used to send a plain text message providing all available parameters.
44+
45+
- `sendMessage(String message)` - This method is used to send a plain text message with default title.
4446

4547
- `sendMessage(String message, @Nullable String title)` - This method is used to send a plain text message.
4648

49+
- `sendMessage(String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a plain text message with TTL.
50+
4751
- `sendHtmlMessage(String message, @Nullable String title)` - This method is used to send a HTML message.
4852

53+
- `sendHtmlMessage(String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a HTML message with TTL.
54+
4955
- `sendMonospaceMessage(String message, @Nullable String title)` - This method is used to send a monospace message.
5056

57+
- `sendMonospaceMessage(String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a monospace message with TTL.
58+
5159
- `sendAttachmentMessage(String message, @Nullable String title, String attachment, @Nullable String contentType)` - This method is used to send a message with an attachment. It takes a local path or URL to the attachment (parameter `attachment` **mandatory**). Additionally you can pass a data URI scheme to this parameter. Optionally pass a `contentType` to define the content-type of the attachment (default: `image/jpeg` or guessed from image data).
5260

61+
- `sendAttachmentMessage(String message, @Nullable String title, String attachment, @Nullable String contentType, @Nullable Duration ttl)` - This method is used to send a message with an attachment and TTL. See previous method for details.
62+
5363
- `sendURLMessage(String message, @Nullable String title, String url, @Nullable String urlTitle)` - This method is used to send a message with an URL. A supplementary `url` to show with the message and a `urlTitle` for the URL, otherwise just the URL is shown.
5464

65+
- `sendURLMessage(String message, @Nullable String title, String url, @Nullable String urlTitle, @Nullable Duration ttl)` - This method is used to send a message with an URL and TTL. See previous method for details.
66+
5567
- `sendMessageToDevice(String device, String message, @Nullable String title)` - This method is used to send a message to a specific device. Parameter `device` **mandatory** is the name of a specific device (multiple devices may be separated by a comma).
5668

69+
- `sendMessageToDevice(String device, String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a message to a specific device with TTL. See previous method for details.
70+
5771
- `sendPriorityMessage(String message, @Nullable String title, @Nullable Integer priority)` - This method is used to send a priority message.
5872
Parameter `priority` is the priority to be used (`-2` = lowest priority, `-1` = low priority, `0` = normal priority, `1` = high priority, `2` = emergency priority; default: `2`).
5973
For priority `2` only, the action returns a `String` value (the `receipt`) if the message was sent successfully, otherwise `null`.
@@ -100,3 +114,27 @@ if( receipt !== null ) {
100114
receipt = null
101115
}
102116
```
117+
118+
:::: tabs
119+
120+
::: tab DSL
121+
122+
```java
123+
val actions = getActions("pushover", "pushover:pushover-account:account")
124+
// send expiring message
125+
actions.sendMessage("Boost has been activated", "Recuperator", Duration.ofHours(1))
126+
```
127+
128+
:::
129+
130+
::: tab JavaScript
131+
132+
```javascript
133+
var pushoverActions = actions.thingActions('pushover', 'pushover:pushover-account:account');
134+
// send expiring message
135+
pushoverActions.sendMessage("Boost has been activated", "Recuperator", time.Duration.ofHours(1));
136+
```
137+
138+
:::
139+
140+
::::

0 commit comments

Comments
 (0)