]> git.basschouten.com Git - openhab-addons.git/commitdiff
[pushover] Provides the ability to specify a timeout in the config (#10817)
authorridiekel <dierckx.geroen@gmail.com>
Wed, 9 Jun 2021 05:12:30 +0000 (07:12 +0200)
committerGitHub <noreply@github.com>
Wed, 9 Jun 2021 05:12:30 +0000 (07:12 +0200)
* Provides the ability to specify a timeout in the config, instead of using hardcoded 10 seconds.

Signed-off-by: Geroen Dierckx <geroen.dierckx@gmail.com>
bundles/org.openhab.binding.pushover/README.md
bundles/org.openhab.binding.pushover/src/main/java/org/openhab/binding/pushover/internal/config/PushoverAccountConfiguration.java
bundles/org.openhab.binding.pushover/src/main/java/org/openhab/binding/pushover/internal/connection/PushoverAPIConnection.java
bundles/org.openhab.binding.pushover/src/main/resources/OH-INF/config/config.xml

index 1719689689c9e7e0293ab5169fe7f950c37c10e9..314c846c386a49302208f57da80bb073132cb4ee 100644 (file)
@@ -21,6 +21,7 @@ You are able to create multiple instances of this Thing to broadcast to differen
 | `sound`                 | text    | The default notification sound on target device (default: `default`) (see [supported notification sounds](https://pushover.net/api#sounds)).         |
 | `retry`                 | integer | The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user (default: `300`). **advanced** |
 | `expire`                | integer | The expire parameter specifies how long (in seconds) your notification will continue to be retried (default: `3600`). **advanced**                   |
+| `timeout`               | integer | The timeout parameter specifies maximum number of seconds a request to Pushover can take. **advanced**                                               |
 
 The `retry` and `expire` parameters are only used for emergency-priority notifications.
 
index 8622d686e3cb69cf55406040477d6d1d02964627..4a39c0022f9ed9f1314b217b55a96013f62e1ae8 100644 (file)
@@ -31,4 +31,5 @@ public class PushoverAccountConfiguration {
     public String sound = DEFAULT_SOUND;
     public int retry = 300;
     public int expire = 3600;
+    public int timeout = 10;
 }
index 8e8f6e820c1d31b37754e3ad952aec81399e8dc5..8f84241d44ba4658a655e895c12a484db8dd087e 100644 (file)
@@ -134,7 +134,8 @@ public class PushoverAPIConnection {
             throws PushoverCommunicationException, PushoverConfigurationException {
         logger.trace("Pushover request: {} - URL = '{}'", httpMethod, url);
         try {
-            final Request request = httpClient.newRequest(url).method(httpMethod).timeout(10, TimeUnit.SECONDS);
+            final Request request = httpClient.newRequest(url).method(httpMethod).timeout(config.timeout,
+                    TimeUnit.SECONDS);
 
             if (body != null) {
                 if (logger.isTraceEnabled()) {
index 8e74c72613cf833ca5ddd7c6c6dca42fadb6d6f2..09a61f1622773897e42f151f7ff0a97566d65f1d 100644 (file)
                        <description>The expire parameter specifies how long your notification will continue to be retried.</description>
                        <default>3600</default>
                </parameter>
+               <parameter name="timeout" type="integer" min="0" max="10800" unit="s">
+                       <advanced>true</advanced>
+                       <label>Timeout</label>
+                       <description>The timeout parameter specifies maximum number of seconds a request to Pushover can
+                               take.</description>
+                       <default>10</default>
+               </parameter>
        </config-description>
 
 </config-description:config-descriptions>