prowl.pngThe challenge may be over, it doesn't mean the project cannot be further improved or expanded!

 

In this post, I will cover the notification feature for iOS devices using Prowl, which can be useful to notify the home owner in case of anomalies. An example could be that the garage has been opened while the key is still in the key holder, or that the front door remains open longer than a certain amount of time. I have covered this in the past, during the Forget Me Not Design Challenge, but as I'm using OpenHAB 2, some steps are different in the deployment of the notification feature, hence the new, updated post.

 

OpenHAB 2

 

The main difference since last time, is that I'm using the OpenHAB 2 beta, and not all bindings have been ported to the beta yet. As a consequence, I have to manually add the OpenHAB 1 Prowl binding into my OpenHAB 2 installation. Though I'm currently using this procedure for the Prowl binding, this should be applicable to any other OH1 binding not yet available for OH2, assuming they are compatible.

 

Compatibility

 

Because we will be running a OH1 addon in OH2, we need to verify this feature is enabled in OH2. This is done by manually starting OH2 and entering some commands at the prompt.

 

Manually start OH2:

 

pi@pictrl_livingroom:~ $ sudo /usr/share/openhab2/start.sh
Launching the openHAB runtime...


                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.0.0.b3


Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.


openhab>

 

Verify the "openhab-runtime-compat1x" is installled, it was in my case:

 

openhab> feature:list | grep compat
shell-compat                              | 4.0.4            |          | Uninstalled | standard-4.0.4          | Karaf Shell Compatibility
openhab-runtime-compat1x                  | 2.0.0.b3         | x        | Started     | openhab-aggregate-xml   | Compatibility layer for openHAB 1 addons

 

If it isn't, install it:

 

openhab> feature:install openhab-runtime-compat1x

 

That should be enough to run OH1 addons in OH2.

 

Deploy

 

Next, deploy the actual addon.

 

Go to the "/tmp" folder and download the addons from the openhab website:

 

pi@pictrl_livingroom:~ $ cd /tmp/
pi@pictrl_livingroom:/tmp $ wget https://bintray.com/artifact/download/openhab/bin/distribution-1.8.3-addons.zip

 

Unzip the package and move the desired addon to the OH2 addons folder:

 

pi@pictrl_livingroom:/tmp $ unzip distribution-1.8.3-addons.zip
pi@pictrl_livingroom:/tmp $ sudo mv /tmp/org.openhab.action.prowl-1.8.3.jar /usr/share/openhab2/addons/

 

Cleanup the remaining addons:

 

pi@pictrl_livingroom:/tmp $ rm -rf org.openhab.*

 

The addon is now deployed.

 

Configure

 

Finally, configure the addon with the necessary parameters. In case of the prowl notifications, and API key is required. This key can be obtained by creating a free account on https://www.prowlapp.com.

 

Screen Shot 2016-09-02 at 21.46.11.png

 

Once you have a key, create the prowl service config as follows:

 

pi@pictrl_livingroom:~ $ sudo nano /etc/openhab2/services/prowl.cfg

prowl:apikey=your_api_key_here
prowl:defaultpriority=0
prowl:url=https://api.prowlapp.com/publicapi/

 

Prowl is now ready for use!

 

Use

 

Server

 

On the server side, OpenHAB rules can be used to trigger notifications when a certain condition is met. A sample rule would look like this:

 

import org.joda.time.*
import org.openhab.model.script.actions.*

var Timer alertOn

rule "Alert Light"
when
    Item EnOcean_sensor_00298B1A_B received update
then
    sendCommand(TowerLight, 1)
    pushNotification("Alert!", "You have been summoned.")

    if(alertOn!=null) {
       alertOn.cancel()
    }
    alertOn = createTimer(now.plusMinutes(5)) [|
        sendCommand(TowerLight, 0)
    ]

end

 

This rule will light up the Tower light when the correct button is pressed, and will in addition, trigger a push notification.

 

Client

 

On the client (your smartphone, tablet, etc ...) an app is required: Prowl. Download and install the app, use the same credentials to log in as used to request an API key. You are now ready to receive notifications!

 

When the above rule is triggered, a notification appears in the device:

 

IMG_2369.PNGIMG_2370.PNGIMG_2371.PNG

 

Et voila, custom notifications!

 

 


arrow_prev.png

 


Navigate to the next or previous post using the arrows.

arrow_next.png