Skip to content

Commit

Permalink
[pushover] Add support for Expiring Messages (openhab#15289)
Browse files Browse the repository at this point in the history
* Add support for Expiring Messages
* Add action variants with TTL parameter

Resolves openhab#15288

---------

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
  • Loading branch information
jlaur authored and austvik committed Mar 27, 2024
1 parent a3e24bc commit f9cbcb8
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 18 deletions.
40 changes: 39 additions & 1 deletion bundles/org.openhab.binding.pushover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,34 @@ The parameter `message` is **mandatory**, the `title` parameter defaults to what
Parameters declared as `@Nullable` are not optional.
One has to pass a `null` value if it should be skipped or the default value for it should be used.

- `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.
- `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.

- `sendMessage(String message)` - This method is used to send a plain text message with default title.

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

- `sendMessage(String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a plain text message with TTL.

- `sendHtmlMessage(String message, @Nullable String title)` - This method is used to send a HTML message.

- `sendHtmlMessage(String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a HTML message with TTL.

- `sendMonospaceMessage(String message, @Nullable String title)` - This method is used to send a monospace message.

- `sendMonospaceMessage(String message, @Nullable String title, @Nullable Duration ttl)` - This method is used to send a monospace message with TTL.

- `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).

- `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.

- `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.

- `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.

- `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).

- `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.

- `sendPriorityMessage(String message, @Nullable String title, @Nullable Integer priority)` - This method is used to send a priority message.
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`).
For priority `2` only, the action returns a `String` value (the `receipt`) if the message was sent successfully, otherwise `null`.
Expand Down Expand Up @@ -100,3 +114,27 @@ if( receipt !== null ) {
receipt = null
}
```

:::: tabs

::: tab DSL

```java
val actions = getActions("pushover", "pushover:pushover-account:account")
// send expiring message
actions.sendMessage("Boost has been activated", "Recuperator", Duration.ofHours(1))
```

:::

::: tab JavaScript

```javascript
var pushoverActions = actions.thingActions('pushover', 'pushover:pushover-account:account');
// send expiring message
pushoverActions.sendMessage("Boost has been activated", "Recuperator", time.Duration.ofHours(1));
```

:::

::::
Loading

0 comments on commit f9cbcb8

Please sign in to comment.