[SOLVED] How to use sendNotification in jsr233 Rules

In my current “normal” rules in Snapshot 2.3 I use sendNotification to send messages to different registered android devices over myOpenhab:
sendNotification(‘mail-address’,‘message’)

I tried to use the same command in my jython rules, but nothing happens.
Does anybody know how to send messages to android devices out of jython-rules?

Kind regards
Thomas

@nasi_be I use the following in my rules:

from openhab.actions import Pushover, Mail

Mail.sendMail('user@domain.de','Testmail','Text') 

Hi,

thanks for answering, but this doesn’t solve my problem.

In my standard rules I use sendNotification(‘mail-address’,‘message’) to push messages via google cloud messaging (GCM) directly to the registered smartphone and not via sending mails.

And this function I would like to use in my jython scripts/rules.

Sorry, can’t help you there. I don’t use myOpenHAB.

Oh, that’s a pity, but thanks for trying.

Anyone else using push-notifications with myOpenHab out of jsr223-rules?

I found some more information.
The following error message is raised, when the function is called:

[ERROR] [ipse.smarthome.automation.ContactRule] - Traceback (most recent call last):
File “”, line 21, in timerEval
NameError: global name ‘sendNotification’ is not defined

Has anyone an idea which java-class is called, when executing sendNotification in the XTend-Rules?

Kind regards
Thomas

Hi,

for those who have the same problem:

I found the solution in the source-code from openhabcloud in the github-repository “openhab-addons”.
To send notificaitons to the smartphone over the openhab-cloud-service you need the following lines:

import org.openhab.io.openhabcloud.NotificationAction as NotificationAction

NotificationAction.sendNotification(<mail-adress>,<message>)
6 Likes