Widget to send action to THING directly without Rule - Possible?

Hi Everyone.

I am currently using the Caddx Binding with OpenHab 3.1.0 M3 to control my alarm system.
I have been using rules and sitemaps, however am trying to migrate to widgets - so have been working on a “self contained” widget - which would require replacing some rules with actions directly from the widget.

I would like to know if I can replace the following rule with an action in my widget:

rule "Partion 3 Arm in STAY"
when
    Item Partition3_Stay  received command ON
then
if (Partition3_ReadyToArm.state == OFF) {
    logWarn("actions", "Ready to ARM is OFF")
    Alarm_Feedback.postUpdate("Ready to ARM is OFF")
            createTimer(now.plusSeconds(5), [
            Alarm_Feedback.postUpdate("")
        ])
}
else if (Partition3_Armed.state == ON) {
    logWarn("actions", "Alarm is already ARMED")
    Alarm_Feedback.postUpdate("Alarm is already ARMED")
            createTimer(now.plusSeconds(5), [
            Alarm_Feedback.postUpdate("")
        ])
}
else {
    val actions = getActions("caddx","caddx:partition:e59e4935:partition3")
    if (null === actions) {
        logWarn("actions", "Actions not found, check thing ID for bridge")
        return
    }
    logWarn("actions", "Ready to ARM is ON ")
    logInfo("actions", "Actions " + actions)
    actions.stay()
}
end

The action gets sent directly to the Partition 3 Thing - returned as follows when rule is run:

07:30:30.811 [WARN ] [org.openhab.core.model.script.actions] - Ready to ARM is ON 
07:30:30.950 [INFO ] [org.openhab.core.model.script.actions] - Actions org.openhab.binding.caddx.internal.action.CaddxPartitionActions@7040bbc1

I am using the following widget component:

            config:
              action: command
              actionCommand: ON
              actionItem: =(props.partitionPrefix) + '_Stay'
              title: STAY
              listButton: true

I am not sure how to add the actionItem to use the THING - “caddx”,“caddx:partition:e59e4935:partition3”

The field only seems to accept Items - tested via props. Only Items are offered as options. Also could not get any logging when trying the different options.

Other examples I have looked at (Harmony Hub, Hue, etc) seem to use a Group which includes some Items from the Thing, but could not get that to work.

Any suggestions and advise would be appreciated as I am not even sure if this is possible in teh current version?

Thanks as always.
Mark

Well, you’r not going to trigger an action to happen in a widget. You’re not going to be able to postUpdate to any Items from a widget. You’re not going to be able to log from a widget. One cannot call an Action from a widget. Actions are only accessible in rules.

In short, you must use a Rule for this.

Thank you @rlkoshak
That is what I was concerned about. Glad I asked before I spent more time trying to make it work…

With your insights do you think this will be introduced in the future, or is there no general call/requirement?

No, I can’t see a case where this would ever be implemented. You want to implement logic and behaviors in your UI. OH is specifically designed and architected to separate the logic/behaviors from the display. That’s why we can have more than one Rules language or even more than one Rules engine without needing to change the UIs. And it’s also why OH can have multiple UIs without changing the rules.