From 7d25c2bc72d744c44e0331370bdef59c5b10698a Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 22 Nov 2023 13:36:55 +0100 Subject: [PATCH] pushover: add ttl parameter --- pushover/README.md | 8 ++++++-- pushover/__init__.py | 7 +++++-- pushover/plugin.yaml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pushover/README.md b/pushover/README.md index 678c2feb1..74131566a 100755 --- a/pushover/README.md +++ b/pushover/README.md @@ -8,6 +8,9 @@ Pushover is one out of many push services, which is compatible with Android, IOS --- ## Changelog +__2023-11-22__: +* add ttl parameter + __2018-10-04__: * Use new lib.network @@ -40,7 +43,7 @@ Description of the attributes: --- ## Usage: -### sh.po(title, message [, priority] [, retry] [, expire] [, sound] [, url] [, url_title] [, device] [, userKey] [, apiKey]) +### sh.po(title, message [, priority] [, retry] [, expire] [, ttl] [, sound] [, url] [, url_title] [, device] [, userKey] [, apiKey]) Send a message to your device. #### Parameters @@ -49,6 +52,7 @@ Send a message to your device. * __priority__: Priority of the message - read https://pushover.net/api#priority * __retry__: when Emergency priority set, this specifies how often (in seconds) the Pushover servers will send the same notification to the user - read https://pushover.net/api#priority * __expire__: when Emergency priority set, this specifies how many seconds your notification will continue to be retried for (every retry seconds) - read https://pushover.net/api#priority +* __ttl__: specifies the time to live in seconds (ignored for priority 2 messages) - read https://pushover.net/api#ttl * __sound__: override a user's default tone choice on a per-notification basis - read https://pushover.net/api#sounds * __url__: adds a supplementary URL that is not included in the message text, but available for the user to click on - read https://pushover.net/api#urls * __url_title__: the title for the a supplementary URL - read https://pushover.net/api#urls @@ -72,7 +76,7 @@ sh.po("Simple Test", "This is my test message.") sh.po("Warning", "Your door is not locked!", 1) # send simple message to device with id: e6653 -sh.po("Simple Test", "This is my test message", None, None, None, None, None, None, "e6653") +sh.po("Simple Test", "This is my test message", device="e6653") # send a message with an attached image (camera snapshot for example) sh.po(title="Simple Test", message="This is my test message", attachment="/tmp/snapshot.jpg") diff --git a/pushover/__init__.py b/pushover/__init__.py index ca1c8e2ef..7b2b82418 100755 --- a/pushover/__init__.py +++ b/pushover/__init__.py @@ -30,7 +30,7 @@ class Pushover(SmartPlugin): - PLUGIN_VERSION = "1.6.1" + PLUGIN_VERSION = "1.6.2" _url = "https://api.pushover.net/1/messages.json" @@ -49,7 +49,7 @@ def run(self): def stop(self): self.alive = False - def __call__(self, title=None, message='', priority=None, retry=None, expire=None, sound=None, url=None, url_title=None, device=None, userKey=None, apiKey=None, attachment=None): + def __call__(self, title=None, message='', priority=None, retry=None, expire=None, ttl=None, sound=None, url=None, url_title=None, device=None, userKey=None, apiKey=None, attachment=None): data = {} data['timestamp'] = int(time.time()) @@ -93,6 +93,9 @@ def __call__(self, title=None, message='', priority=None, retry=None, expire=Non else: self.logger.error("Pushover message priority need to be a number between -2 and 2!") + if ttl: + data['ttl'] = ttl + if sound: data['sound'] = sound diff --git a/pushover/plugin.yaml b/pushover/plugin.yaml index 11caf9480..bbf782578 100755 --- a/pushover/plugin.yaml +++ b/pushover/plugin.yaml @@ -10,7 +10,7 @@ plugin: maintainer: 'Thomas Creutz' tester: None state: ready - version: 1.6.1 # Plugin version + version: 1.6.2 # Plugin version sh_minversion: 1.5 # minimum shNG version to use this plugin multi_instance: True # plugin supports multi instance restartable: unknown