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.automation.jsscripting/README.md
+30-14
Original file line number
Diff line number
Diff line change
@@ -650,6 +650,15 @@ var response = actions.HTTP.sendHttpGetRequest('<url>');
650
650
651
651
Replace `<url>` with the request url.
652
652
653
+
#### Ping Actions
654
+
655
+
See [openhab-js : actions.Ping](https://openhab.github.io/openhab-js/actions.html#.Ping) for complete documentation.
656
+
657
+
```javascript
658
+
// Check if a host is reachable
659
+
var reachable =actions.Ping.checkVitality(host, port, timeout); // host: string, port: int, timeout: int
660
+
```
661
+
653
662
#### ScriptExecution Actions
654
663
655
664
The `ScriptExecution` actions provide the `callScript(string scriptName)` method, which calls a script located at the `$OH_CONF/scripts` folder, as well as the `createTimer` method.
@@ -737,44 +746,51 @@ There are three different types of notifications:
737
746
- Standard Notifications: Sent to the registered devices of the specified user and shown as notification on his devices.
738
747
- Log Notifications: Only shown in the notification log, e.g. inside the Android and iOS Apps.
739
748
749
+
In addition to that, notifications can be updated later be re-using the same `referenceId` and hidden/removed either by `referenceId` or `tag`.
750
+
740
751
To send these three types of notifications, use the `notificationBuilder(message)` method of the `actions` namespace.
741
752
It returns a new `NotificationBuilder` object, which by default sends a broadcast notification and provides the following methods:
742
753
743
754
- `.logOnly()`: Send a log notification only.
755
+
- `.hide()`: Hides notifications with the specified `referenceId` or `tag`.
756
+
- `.addUserId(emailAddress)`: By adding the email address(es) of specific openHAB Cloud user(s), the notification is only sent to this (these) user(s).
744
757
- `.withIcon(icon)`: Sets the icon of the notification.
745
-
- `.withSeverity(link)`: Sets the severity of the notification.
758
+
- `.withTag(tag)`: Sets the tag of the notification. Used for grouping notifications and to hide/remove groups of notifications.
746
759
- `.withTitle(title)`: Sets the title of the notification.
747
-
- `.addUserId(emailAddress)`: By adding the email address(es) of specific openHAB Cloud user(s), the notification is only sent to this (these) user(s).
748
-
- `.withOnClickAction(action)`: Sets the action to be performed when the notification is clicked.
760
+
- `.withReferenceId(referenceId)`: Sets the reference ID of the notification. If none is set, but it might be useful, a random UUID will be generated.
761
+
The reference ID can be used to update or hide the notification later by using the same reference ID again.
762
+
- `.withOnClickAction(action)`: Sets the action to be executed when the notification is clicked.
749
763
- `.withMediaAttachmentUrl(mediaAttachmentUrl)`: Sets the URL of a media attachment to be displayed with the notification. This URL must be reachable by the push notification client.
750
-
- `.addActionButton(title, action)`: Adds an action button to the notification. Please note that due to Android and iOS limitations, only three action buttons are supported.
751
-
- `.send()`: Sends the notification.
764
+
- `.addActionButton(label, action)`: Adds an action button to the notification. Please note that due to Android and iOS limitations, only three action buttons are supported.
765
+
- `.send()` ⇒ `string|null`: Sends the notification and returns the reference ID or `null` for log notifications and when hiding notifications.
766
+
767
+
The syntax for the `action` parameter is described in [openHAB Cloud Connector: Action Syntax](https://www.openhab.org/addons/integrations/openhabcloud/#action-syntax).
752
768
753
-
The syntax for the `action` parameter is described in [openHAB Cloud Connector: Action Syntax](https://www.openhab.org/addons/integrations/openhabcloud/#action-syntax).
769
+
The syntax for the `mediaAttachmentUrl` parameter is described in [openHAB Cloud Connector](https://www.openhab.org/addons/integrations/openhabcloud/).
Copy file name to clipboardexpand all lines: bundles/org.openhab.automation.jsscripting/pom.xml
+1-1
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@
24
24
</bnd.importpackage>
25
25
<graal.version>22.0.0.2</graal.version> <!-- DO NOT UPGRADE: 22.0.0.2 is the latest version working on armv7l / OpenJDK 11.0.16 & armv7l / Zulu 17.0.5+8 -->
0 commit comments