Notifications from the house
A very practical function in the SmartHome is to automatically send notifications to the mobile phone. For example, the house can draw attention to a battery in a sensor that needs to be changed, remind people to take out their garbage or send a warning if a window or door is opened when there is actually no one at home.
I use the PushOver service for these notifications. This service provides a native app for iOS and Android and has an API to send these notifications comfortably. Also other services like IFTTT and many more can be connected. And: PushOver is free of charge.
Setting up a PushOver account
On pushover.net/signup you can register a new account within a few minutes and very easily. After the login the user key will be displayed. We need this key for the configuration. But before that, we add a new application further down the page and get an API key for it (we need this too).
The app should be installed on the corresponding devices; in the PushOver overview, these devices can be given a suitable name - this way, we can also send messages to individual devices in OpenHAB; e.g. the last person to leave the house will be informed if a window is forgotten to close.
With this information, we now have everything we need for OpenHAB.
Configuring PushOver in OpenHAB
In the PaperUI we click on AddOns, Actions and search for PushOver. And we install this action. :)
This has created a new file pushover.cfg in /etc/openhab2/services/ which we are editing. Here we store the user key (defaultUser) and the API key (defaultToken). You can also set default settings such as delivery priority etc. here, but I have not changed this. With each call the default settings can be overwritten individually.
and send messages
Now we can easily send messages in our ruleset; in this (rather nonsensical) example, a message is sent every time a certain window is opened.
rule "Dining_room_window_open" when Item Window ContactDining Room_1_State changed from CLOSED to OPEN then sendPushoverMessage( pushoverBuilder("The window in the dining room has been opened.") .withDevice("iPhoneMarc") .withTitle("Information") .withPriority(1) .withSound("gamelan") ) end
All possible API options are listed in the PushOver documentation.
Comments (0)No comments found!