[ntfy] Wrong casting in DSL rules for Ntfy Binding

The fix was backported:

So, I can’t really explain why it doesn’t work for you with 5.2.1. Does it start working if you use the JAR I provided with 5.2.1?

Please note that there should be no need for casting.

However, I took a second look at the Ntfy actions, and it seems to me like there’s a “design flaw” with the whole fluent thing there. The methods used by DSL are static, but they keep returning an actual instance. I don’t quite grasp how this is supposed to work, but it’s certainly not thread-safe. I’m pretty sure that it two rules are trying to “build” a message at once, they will clobber each other.

Also, I see this:

    public @ActionOutput(label = "Ntfy Actions", type = "org.openhab.core.thing.binding.ThingActions") NtfyActions withTag(

I’m not entirely sure how @ActionOutput is applied, but if impacts the return type, the return type will still be ThingActions, not NtfyActions as it needs to be. Which raises the question why it worked at all with my build.

If i remember correctly @Lolodomo did some work in the past on the return types, not specific for this binding, but generic on the ActionOutput. Maybe he remembers and can share some thoughts on this matter.

Having an action that returns a Java object is uncommon. I don’t know if it can work in DSL Rule as proposed.
At least I am certain it is an action that will not be supported by Main UI.

It can work, it works when I test it, but as I said, there are threading issues here. But, it seems that the return type is “inconsistent”. For the “fluent pattern” to work, the return type must be the actual type, not the interface.

You can’t use a “fluent pattern” to build a message from the UI anyway. The actions should probably be redesigned to offer both fluent and “non-fluent” alternatives.