element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Blog [Pi IoT] Alarm Clock #23: Notifications (Post-Challenge)
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fvan
  • Date Created: 2 Sep 2016 8:16 PM Date Created
  • Views 710 views
  • Likes 3 likes
  • Comments 0 comments
  • fvan_piiot
  • piiot
  • prowl
  • notifications
Related
Recommended

[Pi IoT] Alarm Clock #23: Notifications (Post-Challenge)

fvan
fvan
2 Sep 2016

  • OpenHAB 2
    • Compatibility
    • Deploy
    • Configure
    • Use
      • Server
      • Client

 

The challenge may be over, it doesn't mean the project cannot be further improved or expanded! image

 

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.

 

image

 

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:

 

imageimageimage

 

Et voila, custom notifications!

 

 


image

 


Navigate to the next or previous post using the arrows.

image
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube