How to retrieve the receivedCommand from the triggeringItem?

Hello,
I have difficulties getting this concept to work for my items type = dimmer:

When I copy/paste the code into DSL on my openHAB 3.4.4 installation I ran into this syntax issue: Type mismatch: cannot convert from Command to String

It seems to me that it doesn’t like the implicit variable receivedCommand used in:

    if(proxy.state != receivedCommand) proxy.postUpdate(receivedCommand)
    if(ui.state != receivedCommand) ui.postUpdate(receivedCommand)
    if(rules.state != receivedCommand) rules.postUpdate(receivedCommand)

I tried to work around the issue by using triggeringItem.state which technically works, but does not give me the desired result. The rule triggers due to Member of LightControls received command, and I experience that the rule often fires before triggeringItem.state is updated, in case it is the device.

What syntax can I use to retrieve the receivedCommand from the triggeringItem? I went through the rules page in the docs multiple times now, but I don’t see the solution.

I couldn’t tell you why the error message is happening but it should work to just go with it. If it can’t convert the Command to a String, do it yourself.

if(proxy.state.toString() !== receivedCommand.toString())...

Please be aware that a received command is not the same as an update to a state.

If the rule is triggereing through Member of gGroup received command, simply use
receivedCommand for the command which was received and
triggeringItem.name for the name of the triggering Item.
In case of a Member of trigger, triggeringItem is a genericItem, so you could also use other Item specific stuff like triggeringItem.label.