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?
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.
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?
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>)