The openHAB Cloud Connector allows connecting the local openHAB runtime to a remote [openHAB Cloud](https://github.com/openhab/openhab-cloud/blob/master/README.md) instance, such as [myopenHAB.org](https://www.myopenHAB.org), which is an instance of the
openHAB Cloud service hosted by the [openHAB Foundation](https://www.openhabfoundation.org/).
## Features
The openHAB Cloud service (and thus the connector to it) is useful for different use cases:
* It allows remote access to local openHAB instances without having to expose ports to the Internet or to require a complex VPN setup.
After installing this add-on, you will find configuration options in the openHAB portal under _Settings -> Add-on Settings -> openHAB Cloud Connector_:
For private hosted myopenHAB installations, the base URL can be changed to point another cloud instance.
Private hosted myopenHAB installations may enable selected items in openHAB to have their state updates pushed to the cloud service for integrations with services like IFTTT.
Note that this is not supported on the community hosted myopenHAB service due to high load concerns and will have no effect if enabled with the default URL configured.
This is also not required for remote access through the cloud service to function.
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).
To send push notifications, the notification actions have to be used in rules.
### Basic Usage
Three different actions are available:
-`sendNotification(emailAddress, message)`: Send a notification to a _specific_ openHAB Cloud user.
-`sendBroadcastNotification(message)`: Send a broadcast notification to _all_ devices of _all_ users.
-`sendLogNotification(message)`: Send a log notification to the notifications list. Log notifications do not trigger a notification on the device.
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.
The parameters for these actions have the following meaning:
-`emailAddress`: String containing the email address the target user is registered with in the cloud instance.
-`message`: String containing the notification message text.
The additional parameter for these variants have the following meaning:
-`title`: The title of the notification. Defaults to "openHAB" inside the Android and iOS apps.
-`onClickAction`: The action to be performed when the user clicks on the notification. Specified using the [action syntax](#action-syntax).
-`mediaAttachmentUrl`: The URL of the media attachment to be displayed with the notification. This URL must be reachable by the push notification client.
-`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).
-`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).
-`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).
-`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.
-`ui`: Controls the UI in two possible ways:
-`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).
-`ui:$commandItemSyntax` where `$commandItemSyntax` is the same syntax as used for the [UI Command Item]({{base}}/mainui/about.html#ui-command-item).
Examples:
-`command:KitchenLights:ON`
-`command:KitchenBlinds:50`
-`ui:/basicui/app?w=0000&sitemap=main` (use Basic UI to get sitemap URL locations)
-`ui:/some/absolute/path`: Navigates to the absolut path `/some/absolute/path`.
-`ui:navigate:/page/my_floorplan_page`: Navigates Main UI to the page with the ID `my_floorplan_page`.
-`ui:popup:oh-clock-card`: Opens a popup with `oh-clock-card`.
### Examples
Notify the openHAB Cloud user with email address _me@email.com_ that the front door was opened:
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.
```ruby
rule "Open Window Notification" do
changed Apartment_Window, to: OPEN
run do
notify("Apartment window was opened!", icon: "window", severity: "HIGH")