Light & Alarm Notifications

I am having a play around with the openHAB home demo, I am looking to send a notification when a light has been switched on.
At this stage I am not working with physical devices so when I click the light manually I want a notification through to my phone to say the light has been switched on. I have also added a few alarms to the demo and I would like the same procedure for these. Any help appreciated.

Thanks James

Hi @jamesmills56,
some questions in order to understand your scenario:

  • what kind of light do you have? Remote controllable light or standard light?
  • did you configure correctly the mobile app?

Hello @mortommy,
no physical device as of yet, just have a switch light (ON:OFF) on the demo platfrom.

I want it so that when I click the light on it sends a notification to my phone.

App is set up and connected to my platform and working smoothly.

Thanks James

What do you want to use for the alert on your phone? Notify My Android, my.openhab, email, Pushover, Twitter, something else? Are you running OH1 or OH2?

To get an alert using OH 1 you need to do the following generic steps:

  1. Install and configure the desired app on your phone (for my.openhab get the official openHAB app for your phone)
  2. Install the action binding for your desired approach. For example, if you are on an apt-get Linux and you installed using apt-get you can use sudo apt-get install openhab-addons-action-nam to install Notify My Android.
  3. Configure the binding in openhab.cfg, instructions are either in the comments for that section or on the wiki (see the Actions page)
  4. Call the action in your rules to deliver the notification. For example:
rule "Alert for Light1"
when
    Item Light1 received command
then
    notifyMyAndroid("Light 1 Switched", "Light 1 switched to " + receivedCommand.toString)
end

Hello @rlkoshak,

I am currently want the alert to come through on my iPhone and I am using Windows.

I can see through that actions page I need to use the ‘Prowl’ service, is there anyway around this as I can see you again need to download another App on your phone, can it not be done all through the openHAB app?

Thanks James

You must have something running on your phone to receive the alert.

@rlkoshak yes I have the opnHAB app on my phone, I can receive notifications when the platform goes on/off line and receive messages from my.openhab.org

Then just use the my.openhab notifications as documented here here. to send your own notifications.

@rlkoshak im trying to setup the notifications for a single door-contact. the app on my iphone is up and running. the door-contact sends ist state smoothly. but i dont get the notification on my phone.

i created a rule like this:

rule "Alarm für Kontakt Esszimmer"
when
Item StatusWohnT changed
then
sendNotification(“Test1”, "Esszimmer Tür " + receivedCommand.toString)
end

maybe i miss something?

thank you for your help!

Make sure your OH is shown as online in myopenhab.org

it shows as online in myopenhab. i tested via the Send-Message field to send a message to my iphone and it worked.

now, for testing reasons, i switched to the following process:
if a switch is turned ON, a message has to be send to my iphone:

rule “Alarm für Chris außer Haus"
when
Item cChrisAusserHaus changed from OFF to ON
then
sendNotification("c.stoessel@gmail.com”, “Christopher außer Haus”)
end

for the sendNotification line i get a red marke saying: the method sendNotification(String, String) is undefined.

UPDATE: Somehow, it works now :slight_smile: