getActions() always returns null in rule on OH3

Having an issue with getting getActions to work where it always returns null when I am trying to publish an xmpp message. “Actions is null” is always hit and never actually publishes the message. Is this due to OH3 no longer having actions? I took the rule from and slightly modified it.

My Things file for XMPP
The thing id is real all other data has been obfuscated…

Bridge xmppclient:xmppBridge:xmpp "XMPP Client" [ host="", port=2345, username="user", domain="", password="1234" ] {
    Trigger String : xmpp_command [ separator="##" ]

Here is a test rule I am working on ( I have never used getActions before OH3 )

rule "Test rule with separator and reply"
    Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered
   logInfo("testing.rules", "******************  XMPP Triggered!  ********************" )   

    var actionName = receivedEvent.split("##")

    if(actionName.get(1).toLowerCase() == "turn off lights") {
        logInfo("testing.rules", "******************  XMPP! turn off lights received  ********************" )   

        val actions = getActions("xmpp","xmppclient:xmppBridge:xmpp")
       	if(actions === null) 
		    logInfo("actions", "Actions is null")
        actions.publishXMPP( actionName.get(0) ,"All lights were turned off")

Try rebooting openHAB as from memory I read this can happen after a tmp and cache clean is done. If you update openHAB it can do a clean as part of the update. Since moving away from textual configurations I have not seen this occurring anymore. Reboot a few times and see if that solves the issue but actions are working for me in rule files.

I have rebooted a few times already but will do a few more to see if that helps. I do have all of my rules in .rules files. I did see an argument that it seems like it might be a good idea to start using the GUi but I just don’t feel comfortable. I guess I am afraid of having to start everything from scratch if I have a failure… today I backup all my files and while there may be some setup, it would be minimal. Do you think it might be due to having rules in this rules file instead of using GUI? I wouldn’t think so but I guess you never know.

Have you checked your logs? Since I dont use that binding, I can only say that the bindings I use are working fine in OH3 and with rule files. I use the files because they allow global variables which the new scripts do not.

All I see in my openHAB logs is this which is just my debugging comments really.

2020-12-14 06:21:46.909 [INFO ] [nhab.core.model.script.testing.rules] - ******************  XMPP!  triggered! ********************
2020-12-14 06:21:46.910 [INFO ] [nhab.core.model.script.testing.rules] - ******************  XMPP! turn off lights  ********************
2020-12-14 06:21:46.910 [INFO ] [rg.openhab.core.model.script.actions] - Actions is null

I’ll try turning on debug later today on that binding to see if I get anything else. I’ll see if there is any other binding that has the getActions and try that as well to see if it works.

ok so I did a little more testing and I tried the mail binding version of this and it is working. It seems the issue is with the XMPP binding itself as the following code works when I replace the XMPP publish Message…

    val mailActions = getActions("mail","mail:smtp:samplesmtp")
    val success = mailActions.sendMail("", "Test XMPP", "e-mail content here.")

@Pavel_Gololobov by any chance do you know if this is an issue with OH3? Have you been able to publishActions?

Still haven’t found a solution to this but I don’t want the post to close so just bumping the post as I really would love to have a solution to this. Not really sure what to try at this point.

I don’t know if this will help but the publishing part should be covered here:

My XMPP Binding in OH3 does not show channels though and no “payload” characters, so I can’t trigger anything by sending a message back to OH3.

Greetings Eckart

1 Like

@ecko thank you that did the trick!!! I noticed that it was also updated in the documentation of the binding now so that’s great…

Changed from this

        val actions = getActions("xmpp","xmppclient:xmppBridge:xmpp")
        actions.publishXMPP( actionName.get(0) ," Doesnt work :( ")

to this

        val actions = getActions("xmppclient","xmppclient:xmppBridge:xmpp")
        actions.publishXMPP( actionName.get(0) ," It works!! :) ")


I just used your DSL Rule and it worked for me after I manually added a Channel to the XMPP “thing” and definded the seperator there and used the newly created channel as a trigger for the DSL rule.

Thanks and have fun with it!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.