forked from J-N-K/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pushsafer] Initial Contribution of Pushsafer Binding (openhab#10790)
* Pushsafer binding Signed-off-by: Pushsafer.com (Kevin Siml) <info@appzer.de> * Improvements and comments from code review Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> * Incorporated comments from review Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> Co-authored-by: Pushsafer.com (Kevin Siml) <info@appzer.de>
- Loading branch information
1 parent
aeea66e
commit 773c4f5
Showing
25 changed files
with
2,034 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
/~https://github.com/openhab/openhab-addons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Pushsafer Binding | ||
|
||
The Pushsafer binding allows you to notify mobile devices of a message using the [Pushsafer API](https://www.pushsafer.com/pushapi). | ||
To get started you first need to register (a free process) to get a Private Key. | ||
Initially you have to register a device with one of the [client apps](https://www.pushsafer.com/apps), to get a device id. | ||
|
||
## Supported Things | ||
|
||
There is only one Thing available - the `pushsafer-account`. | ||
You are able to create multiple instances of this Thing to broadcast to different devices or groups with push-notification content and setting. | ||
|
||
## Thing Configuration | ||
|
||
| Configuration Parameter | Type | Description | | ||
|-------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `apikey` | text | Your private-key to access the Pushsafer [Message API](https://www.pushsafer.com/pushapi). **mandatory** | | ||
| `user` | text | Your username or email address to validate against the Pushsafer Message API. **mandatory** | | ||
| `device` | text | Your device or group id to which device(s) you want to push notifications. **mandatory** | | ||
| `title` | text | The default title of a message (default: `"openHAB"`). | | ||
| `format` | text | The default format (`"none"`, `"HTML"` or `"monospace"`) of a message (default: `none`). | | ||
| `sound` | text | The default notification sound on target device (default: `1`) (see [supported notification sounds](https://www.pushsafer.com/pushapi#api-sound)). | | ||
| `vibration` | text | How often the device should vibrate. empty=device default or a number 1-3. | | ||
| `icon` | text | The default notification icon on target device (default: `1`) (see [supported notification icons](https://www.pushsafer.com/pushapi#api-icon)). | | ||
| `color` | text | The color (hexadecimal) of notification icon (e.g. #FF0000). | | ||
| `url` | text | URL or [URL Scheme](https://www.pushsafer.com/url_schemes) send with notification. | | ||
| `urlTitle` | text | Title of URL. | | ||
| `retry` | integer | The retry parameter specifies how often (in seconds) the Pushsafer 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** | | ||
| `confirm` | integer | Integer 10-10800 (10s steps) Time in seconds after which a message should be sent again before it is confirmed. (default: `0`). **advanced** | | ||
| `time2live` | integer | Time in minutes, after a message automatically gets purged (default: `0`). **advanced** | | ||
| `answer` | integer | 1 = enables reply to push notifications (default: `0`). **advanced** | | ||
|
||
The `retry` and `expire` parameters are only used for emergency-priority notifications. | ||
|
||
## Channels | ||
|
||
Currently the binding does not support any Channels. | ||
|
||
## Thing Actions | ||
|
||
All actions return a `Boolean` value to indicate if the message was sent successfully or not. | ||
The parameter `message` is **mandatory**, the `title` parameter defaults to whatever value you defined in the `title` related configuration parameter. | ||
|
||
- `sendPushsaferMessage(String message, @Nullable String title)` - This method is used to send a plain text message. | ||
|
||
- `sendPushsaferHtmlMessage(String message, @Nullable String title)` - This method is used to send a HTML message. | ||
|
||
- `sendPushsaferMonospaceMessage(String message, @Nullable String title)` - This method is used to send a monospace message. | ||
|
||
- `sendPushsaferAttachmentMessage(String message, @Nullable String title, String attachment, @Nullable String contentType, @Nullable String authentication)` - This method is used to send a message with an image attachment. It takes a local path or url to the image attachment (parameter `attachment` **mandatory**), an optional `contentType` to define the content-type of the attachment (default: `"jpeg"`, possible values: `"jpeg"`, `"png"`, `"gif"`) and an optional `authentication` for the given URL to define the authentication if needed (default: `""`, example: `"user:password"`). | ||
|
||
- `sendPushsaferURLMessage(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. | ||
|
||
- `sendPushsaferPriorityMessage(String message, @Nullable String title, @Nullable Integer priority)` - This method is used to send a priority message. Parameter `priority` is the priority (`-2`, `-1`, `0`, `1`, `2`) to be used (default: `2`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>3.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.pushsafer</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: Pushsafer Binding</name> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.pushsafer/src/main/feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.pushsafer-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-pushsafer" description="Pushsafer Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.pushsafer/${project.version}</bundle> | ||
</feature> | ||
</features> |
44 changes: 44 additions & 0 deletions
44
...safer/src/main/java/org/openhab/binding/pushsafer/internal/PushsaferBindingConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) 2010-2021 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.pushsafer.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link PushsaferBindingConstants} class defines common constants, which are used across the whole binding. | ||
* | ||
* @author Kevin Siml - Initial contribution, forked from Christoph Weitkamp | ||
*/ | ||
@NonNullByDefault | ||
public class PushsaferBindingConstants { | ||
|
||
private static final String BINDING_ID = "pushsafer"; | ||
|
||
public static final ThingTypeUID PUSHSAFER_ACCOUNT = new ThingTypeUID(BINDING_ID, "pushsafer-account"); | ||
|
||
public static final String CONFIG_SOUND = "sound"; | ||
public static final String CONFIG_ICON = "icon"; | ||
|
||
public static final String ALL_DEVICES = "a"; | ||
public static final String DEFAULT_SOUND = ""; | ||
public static final String DEFAULT_ICON = "1"; | ||
public static final String DEFAULT_COLOR = ""; | ||
public static final String DEFAULT_URL = ""; | ||
public static final String DEFAULT_URLTITLE = ""; | ||
public static final String DEFAULT_VIBRATION = "1"; | ||
public static final int DEFAULT_CONFIRM = 0; | ||
public static final boolean DEFAULT_ANSWER = false; | ||
public static final int DEFAULT_TIME2LIVE = 0; | ||
public static final String DEFAULT_TITLE = "openHAB"; | ||
} |
Oops, something went wrong.