You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: bundles/org.openhab.io.openhabcloud/README.md
+176-2
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,8 @@ openHAB Cloud service hosted by the [openHAB Foundation](https://www.openhabfoun
8
8
The openHAB Cloud service (and thus the connector to it) is useful for different use cases:
9
9
10
10
* It allows remote access to local openHAB instances without having to expose ports to the Internet or to require a complex VPN setup.
11
-
* It serves as a connector to Google Cloud Messaging (GCM) and Apple Push Notifications (APN) for pushing notifications to mobile phone apps.
12
-
* It provides integrations with 3rd party services that require OAuth2 authentication, such as Amazon Alexa or Google Home applications
11
+
* It serves as a connector to Firebase Cloud Messaging (FCM) for pushing notifications to mobile phone apps.
12
+
* It provides integrations with 3rd party services that require OAuth2 authentication, such as Amazon Alexa or Google Home applications.
13
13
14
14
## Installation via UI
15
15
@@ -78,3 +78,177 @@ Alternatively, you can configure the settings in the file `conf/services/openhab
78
78
```
79
79
80
80
Note: The optionally exposed items will show up after they receive an update to their state.
81
+
82
+
## Cloud Notification Actions
83
+
84
+
The openHAB Cloud Connector allows to send push notifications to apps on mobile devices registered with an [openHAB Cloud instance](https://github.com/openhab/openhab-cloud) such as [myopenHAB.org](https://www.myopenhab.org).
85
+
86
+
To send push notifications, the notification actions have to be used in rules.
87
+
88
+
### Basic Usage
89
+
90
+
Three different actions are available:
91
+
92
+
-`sendNotification(emailAddress, message)`: Send a notification to a _specific_ openHAB Cloud user.
93
+
-`sendBroadcastNotification(message)`: Send a broadcast notification to _all_ devices of _all_ users.
94
+
-`sendLogNotification(message)`: Send a log notification to the notifications list. Log notifications do not trigger a notification on the device.
95
+
96
+
For each of the three actions, there's another variant accepting an icon name and a severity:
Icon and severity can potentially be used by cloud instance clients (such as the openHAB apps for Android or iOS) to be displayed in the notification itself and the list of notifications.
103
+
104
+
The parameters for these actions have the following meaning:
105
+
106
+
-`emailAddress`: String containing the email address the target user is registered with in the cloud instance.
107
+
-`message`: String containing the notification message text.
108
+
-`icon`: String containing the icon name (as described in [Items]({{base}}/configuration/items.html#icons)).
109
+
-`severity`: String containing a description of the severity of the incident.
110
+
111
+
`null` may be used to skip the `icon` or `severity` parameter.
112
+
113
+
### Title, Media Attachments & Actions
114
+
115
+
The `sendNotification` and `sendBroadcastNotification` actions additionally support setting a title, media attachments and actions.
116
+
117
+
The title is displayed as the notification title on the device and defaults to "openHAB" for the Android and iOS apps.
118
+
Media attachments are displayed together with the notification on the device and can be used to display images, e.g. a camera snapshot.
119
+
Actions allow the user to interact with the notification, e.g. to open a specific page in the app or to send a command to an Item.
120
+
121
+
There are four different actions available:
122
+
123
+
- click action: Is performed when the user clicks on the notification.
124
+
- action button 1, 2 or 3: Is performed when the user clicks on the first, second or third action button.
125
+
126
+
To specify media attachments and actions, there is another variant of the `sendNotification` and `sendBroadcastNotification` actions:
The additional parameter for these variants have the following meaning:
132
+
133
+
-`title`: The title of the notification. Defaults to "openHAB" inside the Android and iOS apps.
134
+
-`onClickAction`: The action to be performed when the user clicks on the notification. Specified using the [action syntax](#action-syntax).
135
+
-`mediaAttachmentUrl`: The URL of the media attachment to be displayed with the notification. This URL must be reachable by the push notification client.
136
+
-`actionButton1`: The action to be performed when the user clicks on the first action button. Specified as `Titel=$action`, where `$action` follow the [action syntax](#action-syntax).
137
+
-`actionButton2`: The action to be performed when the user clicks on the second action button. Specified as `Titel=$action`, where `$action` follow the [action syntax](#action-syntax).
138
+
-`actionButton3`: The action to be performed when the user clicks on the third action button. Specified as `Titel=$action`, where `$action` follow the [action syntax](#action-syntax).
139
+
140
+
These parameters may be skipped by setting them to `null`.
141
+
142
+
#### Action Syntax
143
+
144
+
The action syntax is a string containing the action type and the action payload seperated by a colon.
145
+
146
+
There are two types of actions available:
147
+
148
+
-`command`: Sends a command to an Item by using the following syntax: `command:$itemName:$commandString` where `$itemName` is the name of the Item and `$commandString` is the command to be sent.
149
+
-`ui`: Controls the UI in two possible ways:
150
+
-`ui:$path` where `$path` is either `/basicui/app?...` for navigating sitemaps (using the native renderer) or `/some/absolute/path` for navigating (using the web view).
151
+
-`ui:$commandItemSyntax` where `$commandItemSyntax` is the same syntax as used for the [UI Command Item]({{base}}/mainui/about.html#ui-command-item).
152
+
153
+
Examples:
154
+
155
+
-`command:KitchenLights:ON`
156
+
-`command:KitchenBlinds:50`
157
+
-`ui:/basicui/app?w=0000&sitemap=main` (use Basic UI to get sitemap URL locations)
158
+
-`ui:/some/absolute/path`: Navigates to the absolut path `/some/absolute/path`.
159
+
-`ui:navigate:/page/my_floorplan_page`: Navigates Main UI to the page with the ID `my_floorplan_page`.
160
+
-`ui:popup:oh-clock-card`: Opens a popup with `oh-clock-card`.
161
+
162
+
### Examples
163
+
164
+
Notify the openHAB Cloud user with email address _[email protected]_ that the front door was opened:
0 commit comments