[SOLVED] Send Pushover Notification from Paper UI "Rules"

Hi,

I am trying to send a push notification using Pushover via a rule in OH2.4 Paper UI.
After installation of the action-pushover - 1.13.0 add-on I configured the services/pushover.cfg as described in the documentation and added a simple New Rule:

Action “execute a given script”
Script “sendPushoverMessage(pushoverBuilder("test message"));

When I execute the script, I get the following error message in openhab.log:
“[ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: ReferenceError: “sendPushoverMessage” is not defined in at line number 1”

I also restarted the OH package on my Synology DiskStation, but this didn’t make any difference.

Maybe my syntax is wrong or OH didn’t load the add-on properly? Any hints are welcome :wink:

Thanks,
Dirk

This is working fine for me:

rule "test pushover" 
when   
    Item Test_Pushover_Message changed to ON
then
	sendPushoverMessage(pushoverBuilder("Test Pushover")
end

I noticed that sometimes I have to send the credentials within the rule:

rule "test pushover" 
when   
    Item Test_Pushover_Message changed to ON
then
	sendPushoverMessage(pushoverBuilder("Test Pushover").withApiKey("xyxyxyxyxyxyxyxyxyxyyx").withUser("babababababababababab").withDevice("mydevice"))
end

The OP is using NRE, New Rules Engine, and trying to call a 1.x Action

Maybe " Non-core Actions" is the relevant part?

:+1:

Note that I haven’t documented how to do it without using the library yet so you will need to use lewie’s library.

Upps, did not read all of the headline :sunglasses:

Thanks for your feedback.
I deleted the rule from NRE and added sihui’s code as new rule in the rules folder.
With this setup it works.

1 Like