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.
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?
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.
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:
- Install and configure the desired app on your phone (for my.openhab get the official openHAB app for your phone)
- 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.
- Configure the binding in openhab.cfg, instructions are either in the comments for that section or on the wiki (see the Actions page)
- Call the action in your rules to deliver the notification. For example:
rule "Alert for Light1"
Item Light1 received command
notifyMyAndroid("Light 1 Switched", "Light 1 switched to " + receivedCommand.toString)
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?
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"
Item StatusWohnT changed
sendNotification(“Test1”, "Esszimmer Tür " + receivedCommand.toString)
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"
Item cChrisAusserHaus changed from OFF to ON
sendNotification("firstname.lastname@example.org”, “Christopher außer Haus”)
for the sendNotification line i get a red marke saying: the method sendNotification(String, String) is undefined.
UPDATE: Somehow, it works now