Sending pushover messages with javascript (ECMA) script

Hello community,
I switched to OH3 and my pushover message sending is broken with the old rules files. So I decided to rewrite and port my rules to javascript scripts. But I don’t know how to use pushover in js. What is the correct syntax to use? I found a few examples but no one was written in javascript. Please help with a complete example because I’m a newbie concerning js. Thanks for your help

It’s a whole lot easier to help if you post what you actually tried and any logs that indicate what went wrong. Otherwise this is an XY Problem. Maybe you did it exactly right and something else is wrong.

ok, here ist my script which runs well except the pushover part. Thanks for your help

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);
var bathroom_window_state = itemRegistry.getItem("bathroom_window_state").getState();
var ScriptExecution = Java.type("org.openhab.core.model.script.actions.ScriptExecution");
var ZonedDateTime   = Java.type("java.time.ZonedDateTime");
var bathroom_window_timer;
var actions = getActions("pushover", "pushover:pushover-account:<pushover username>");

if ( bathroom_window_state == "OPEN") {"bathroom window is open");
  events.sendCommand("group_thermostat_bathroom_openwindow", "OPEN"); 
  this.bathroom_window_timer = ScriptExecution.createTimer(, function(){"bathroom window still open after 20 minutes");
    var receipt = actions.sendMessage("Hello!", "OH3")

if ( bathroom_window_state == "CLOSED") {"bathroom window is closed");
  if (this.bathroom_window_timer !== undefined) {
    this.bathroom_window_timer = undefined;
  events.sendCommand("group_thermostat_bathroom_openwindow", "CLOSED");

Here is the output of the openhab.log when I run the rule.

Script execution of rule with UID 'bbcc59e48b' failed: ReferenceError: "getActions" is not defined in <eval> at line number 6

OK, so that’s easier to answer.

When working with JavaScript I find the best resource when you are not sure how to do something is Helper Libraries for openHAB Scripted Automation — openHAB Helper Libraries documentation. Even if you are not using the Helper Libraries themselves, a lot of what you see there, particularly in the “But How Do I…” section is generic and not specific to that Helper Library.

In this case though accessing and using Actions is shown on the Actions Page. The MQTT2 example at Actions — openHAB Helper Libraries documentation is the most relevant. All actions that are provided by bindings are accessed the same way.

var myaction = actions.get("bindingname", "thinguid");
1 Like

Thanks Rich for your help.