Pushover Binding 3.2 - need help with rules

I totally lost with the migration from oh2.5 to 3.2 binding :frowning:

When switching the pushover button to on I always get this error

[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'test-1' failed: 'sendHtmlMessage' is not a member of 'org.openhab.core.thing.binding.ThingActions'; line 15, column 17, length 78 in test

rule "Pushover Test"
        Item pushover received command
        val actions = getActions("pushover", "pushover:pushover-account:account")
        switch(receivedCommand) {
            case ON: {
                // sendPushoverMessage(pushoverBuilder("test message").withPriority(1).withSound("magic"))
                actions.sendHtmlMessage("Hello <font color='green'>World</font>!", "openHAB3")
                 logInfo("PUSHOVER", "--> on ")


            case OFF: {
                 logInfo("PUSHOVER", "--> off ")


I appreciate any help…

You’ve installed the Pushover binding?

You’ve create the Pushover Thing and configured it as needed?

The Pushover Thing is showing as online in MainUI?

The second argument you’ve passed to getActions is the exact same as the ID for the Pushover Thing? It is almost certainly different from "pushover:pushover-account:account".

Indeed - I have forgotten to install the binding.
Thanks for pointing me in the right direction!

Hello all,

I have recently upgraded to OH 4.0.3 and having some difficulty with uploading Pushover rules. I had run a quick test:

    Item "Pushover_Test" changed
    val actions = getActions("pushover","pushover:pushover-account:My_Pushover")
// send HTML message
actions.sendHtmlMessage("Hello <font color='green'>World</font>!","openHAB")

As I open the Rules in the MainUI under Settings, this particular rule is not listed. However, it is present in the Pushover.rules in the conf folder.

Pushover binding installed, Pushover Thing configured and listed ONLINE.

To further test, I created a Pushover.script file and introduced only

// send HTML message
actions.sendHtmlMessage("Hello <font color='green'>World</font>!","openHAB")

Intrestingly, the script file is listed on the MainUI, and works as expected with the Run Now button.

I would appreciate any advice. Many thanks!


Pushover.script file:

val actions = getActions("pushover","pushover:pushover-account:My_Pushover")
// send HTML message
actions.sendHtmlMessage("Hello <font color='green'>World</font>!","openHAB")

Which folder exactly? .rules files are only read from the $OH_CONF/rules folder. Do you see a “loaded” message in OH logs for this file? Error messages?

Hi Rich,

Thank you much for getting back. To my shame, I have to admit I don’t know how to look that up.
I started from the premise that all other rules ( network, serial, etc) in the same folder were functional. Is there a tutorial I can read to learn the process? Apologies for being unprepared to answer appropriately.

The reference docs for Rules indicate which folder .rules files should go. Rules | openHAB

But given that you created the rule in the first place you should know which folder you saved it in.

Or are you using UI created rules? If that’s the case, your syntax is wrong. The structure of the rule is defined through the forum so in the script action you don’t use when, then, and end.

I created the rule in VSC and placed it in the appropriate .rules folder linked to OH4. I can access the folder vía ssh and the rule is in there. All other rules created the same way, and places in their respective .rules folders. They seem to load well without issues.
Unfortunately, I’m not familiar on how to run a log to see if the Pushover rule is loaded, as you indicated earlier.

I went ahead and created the Pushover rule in Ui and it works.

Just trying to find out the reason why the text file rule not working as expected. Had a similar issue trying to configure MyQ things and items in text file with VSC, but working appropriately via Ui

If you’ve used openHABian, you have Frontail installed and configured to see the logs. Otherwise the logs location depends on how you installed OH. If you used apt/yum they are located in /var/log/openhab. openhab.log is the important one.

Without logs :person_shrugging:

I’m running OH4 in a docker container. I’ll use your recommendations and figure it out. Thx again!

OK, in a docker container situation you’ll find the logs under userdata/logs/openhab.lg where userdata is the host folder mounted into the container as a volume to /openhab/userdata/.

So, I deleted everything Pushover, and started from the beginning.
Uploaded binding, created Thing and Item in text file. Checked on MainUI and Thing is ONLINE. Item visible in MainUI.
Created .rules file, but same, not visible in MainUI.

Opened log file and got the following:

2023-10-17 11:01:03.408 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Pushover.rules'
2023-10-17 11:01:03.420 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'Pushover.rules' is either empty or cannot be parsed correctly!
2023-10-17 11:02:52.329 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Pushover.rules'
2023-10-17 11:02:52.337 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'Pushover.rules' is either empty or cannot be parsed correctly!

Ok, we’ll there you have it. There is something wrong with the .rules file, something fundamental. Maybe it’s using Windows newlines instead of Unix newlines (there is a dos2unix utility that is usually installed) that can correct that? Maybe it’s some weird encoding? Maybe it truly is empty?

One thing you can try is to start with an empty file (this will still generate an error). Then add an empty rule. Then add the contents. See where it breaks.

Alternatively, if you are not married to text file based rules define it in the UI and side step this while issue entirely.

Will do. I guess its part of the learning curve and somehow I feel like cheating if I just go to the UI…
Also, what would be the best way to clean up cache and temp files in docker?

I’ve been using OH since version 1.6. Since OH 3 I’ve used the UI exclusively. It’s definitely not cheating. OH and home automation in general are hard enough on their own. There’s no need to struggle with stuff like syntax and file formats if it’s not necessary.

I even have a few rules written in Blockly.

You should almost never need to do this. The only thing it does is cause OH to redownload and reinstall the add-ons. It’s only necessary when there is a problem installing add-on or a problem with an add-on starting up, or during an upgrade. In the latter case, the image does the cache clearing fire you.

To do it manually, stop the container and delete the contents of userdata/cache and userdata/tmp.

Got it. Meanwhile, I have taken the stepwise approach you suggested and …Voila!!! Now it works!
Much appreciate your patience on this matter. It feels better to learn that there are alternatives