Skip to content

Commit 7475e5d

Browse files
authored
[openhabcloud] Further README improvements (openhab#16942)
Also-by: Jimmy Tanagra <[email protected]> Signed-off-by: Florian Hotze <[email protected]>
1 parent ae34f95 commit 7475e5d

File tree

2 files changed

+77
-20
lines changed

2 files changed

+77
-20
lines changed

bundles/org.openhab.io.openhabcloud/README.md

+77-20
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,39 @@ The openHAB Cloud service (and thus the connector to it) is useful for different
1313

1414
## Installation via UI
1515

16-
* Open the openHAB web portal and login as an administrator.
17-
* Click on Add-on Store, followed by Other
18-
* Using the Install button you can install the openHAB Cloud Connector
19-
* Register your session (https://myopenhab.org/) using UUID and Secret identity
16+
* Open the openHAB web UI and login as an administrator.
17+
* Click on Add-on Store, followed by System Integrations.
18+
* Use the Install button to install the openHAB Cloud Connector.
19+
* Register your session (https://myopenhab.org/) using UUID and Secret.
2020

2121
## UUID and Secret
2222

23-
To authenticate with the openHAB Cloud service the add-on generates two values when the add-on is installed.
23+
To authenticate with the openHAB Cloud service, the add-on generates two values when the add-on is installed.
2424
These values need to be entered in your account settings of the openHAB Cloud service.
25+
2526
The first one is a unique identifier, which allows to identify your runtime.
2627
One can think of it as something similar like a username for the cloud authentication.
2728
The second one is a random secret key which serves as a password.
2829
Both values are written to the local file system.
30+
2931
If you loose these files for some reason, openHAB will automatically generate new ones.
3032
You will then have to reconfigure UUID and secret in the openHAB Cloud service under the _My account_ section.
3133
You will need these values to register on the website before connection is accepted.
3234

3335
Location of UUID and Secret:
3436

35-
| File | Regular Installation | APT Installation |
36-
|--------|------------------------------|---------------------------------------|
37-
| UUID | userdata/uuid | /var/lib/openhab/uuid |
38-
| Secret | userdata/openhabcloud/secret | /var/lib/openhab/openhabcloud/secret |
37+
| File | Regular Installation | APT & RPM Installation |
38+
|--------|---------------------------------------|--------------------------------------|
39+
| UUID | $OPENHAB_USERDATA/uuid | /var/lib/openhab/uuid |
40+
| Secret | $OPENHAB_USERDATA/openhabcloud/secret | /var/lib/openhab/openhabcloud/secret |
3941

4042
## Configuration
4143

4244
After installing this add-on, you will find configuration options in the openHAB portal under _Settings -> Add-on Settings -> openHAB Cloud Connector_:
4345

4446
![Configuration](doc/configuration.png)
4547

46-
By default both remote access and push notifications are enabled.
48+
By default, both remote access and push notifications are enabled.
4749

4850
### Advanced Configuration
4951

@@ -105,7 +107,7 @@ The parameters for these actions have the following meaning:
105107

106108
- `emailAddress`: String containing the email address the target user is registered with in the cloud instance.
107109
- `message`: String containing the notification message text.
108-
- `icon`: String containing the icon name (as described in [Items]({{base}}/configuration/items.html#icons)).
110+
- `icon`: String containing the icon name (as described in [Items: Icons]({{base}}/configuration/items.html#icons)).
109111
- `severity`: String containing a description of the severity of the incident.
110112

111113
`null` may be used to skip the `icon` or `severity` parameter.
@@ -133,15 +135,15 @@ The additional parameter for these variants have the following meaning:
133135
- `title`: The title of the notification. Defaults to "openHAB" inside the Android and iOS apps.
134136
- `onClickAction`: The action to be performed when the user clicks on the notification. Specified using the [action syntax](#action-syntax).
135137
- `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).
138+
- `actionButton1`: The action to be performed when the user clicks on the first action button. Specified as `Title=$action`, where `$action` follows the [action syntax](#action-syntax).
139+
- `actionButton2`: The action to be performed when the user clicks on the second action button. Specified as `Title=$action`, where `$action` follows the [action syntax](#action-syntax).
140+
- `actionButton3`: The action to be performed when the user clicks on the third action button. Specified as `Title=$action`, where `$action` follows the [action syntax](#action-syntax).
139141

140142
These parameters may be skipped by setting them to `null`.
141143

142144
#### Action Syntax
143145

144-
The action syntax is a string containing the action type and the action payload seperated by a colon.
146+
The action syntax is a string containing the action type and the action payload separated by a colon.
145147

146148
There are two types of actions available:
147149

@@ -167,7 +169,7 @@ Notify the openHAB Cloud user with email address [email protected]_ that the front d
167169

168170
::: tab DSL
169171

170-
```java
172+
```java
171173
rule "Front Door Notification"
172174
when
173175
Item Apartment_FrontDoor changed to OPEN
@@ -181,12 +183,29 @@ end
181183

182184
```javascript
183185
rules.when().item('Apartment_FrontDoor').changed().to('OPEN').then(() => {
184-
actions.notificationBuilder('Front door was opened!').addUserId('[email protected]').send();
186+
actions.notificationBuilder('Front door was opened!')
187+
.addUserId('[email protected]')
188+
.send();
185189
}).build('Front Door Notification');
186190
```
187191

188192
:::
189193

194+
::: tab JRuby
195+
196+
```ruby
197+
rule "Front Door Notification" do
198+
changed Apartment_FrontDoor, to: OPEN
199+
run do
200+
notify("Front door was opened!", email: "[email protected]")
201+
end
202+
end
203+
```
204+
205+
See [notify](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Actions.html#notify-class_method)
206+
207+
:::
208+
190209
::::
191210

192211
Notify all openHAB Cloud users that the window was opened:
@@ -210,15 +229,33 @@ end
210229

211230
```javascript
212231
rules.when().item('Apartment_Window').changed().to('OPEN').then(() => {
213-
actions.notificationBuilder('Apartment window was opened!').withIcon('window').withSeverity('HIGH').send();
232+
actions.notificationBuilder('Apartment window was opened!')
233+
.withIcon('window')
234+
.withSeverity('HIGH')
235+
.send();
214236
}).build('Open Window Notification');
215237
```
216238

217239
:::
218240

241+
::: tab JRuby
242+
243+
Broadcast notification is performed by calling [notify](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Actions.html#notify-class_method) without providing an email address.
244+
245+
```ruby
246+
rule "Open Window Notification" do
247+
changed Apartment_Window, to: OPEN
248+
run do
249+
notify("Apartment window was opened!", icon: "window", severity: "HIGH")
250+
end
251+
end
252+
```
253+
254+
:::
255+
219256
::::
220257

221-
Notify all openHAB Cloud users that motion was detected, attach a camera snapshot and add action button to turn on the light:
258+
Notify all openHAB Cloud users that motion was detected, attach a camera snapshot and add an action button to turn on the light:
222259

223260
:::: tabs
224261

@@ -229,7 +266,9 @@ rule "Motion Detected Notification"
229266
when
230267
Item Apartment_MotionSensor changed to ON
231268
then
232-
sendBroadcastNotification("Motion detected in the apartment!", "motion", "MEDIUM", "Motion Detected", null, "https://apartment.my/camera-snapshot.jpg", "command:Apartment_Light:ON", null, null)
269+
sendBroadcastNotification("Motion detected in the apartment!", "motion", "MEDIUM",
270+
"Motion Detected", null, "https://apartment.my/camera-snapshot.jpg",
271+
"Turn on the light=command:Apartment_Light:ON", null, null)
233272
end
234273
```
235274

@@ -251,4 +290,22 @@ rules.when().item('Apartment_MotionSensor').changed().to('ON').then(() => {
251290

252291
:::
253292

293+
::: tab JRuby
294+
295+
```ruby
296+
rule "Motion Detected Notification" do
297+
changed Apartment_MotionSensor, to: ON
298+
run do
299+
notify "Motion detected in the apartment!",
300+
icon: "motion",
301+
severity: "MEDIUM",
302+
title: "Motion Detected",
303+
attachment: "https://apartment.my/camera-snapshot.jpg",
304+
buttons: { "Turn on the light" => "command:Apartment_Light:ON" }
305+
end
306+
end
307+
```
308+
309+
:::
310+
254311
::::
Loading

0 commit comments

Comments
 (0)