Ideas and Discussion: What Features Do You Want in openHAB 5.0?

Along the lines of the linked thread “manual trigger detection”, the general goal was to know if an item command was coming from a GUI interaction, thing channel or particular script. In my case I have different logic if an item is commanded via GUI or a script.

Even if it’s too much work to implement code on the GUI side, being able to do this in scripts is enough by process of elimination. I write all my scripts in ECMAScript 262 Edition 11, and would be handy if I could pass additional data when calling commands from a script. Passing a key/val object would be ideal as that allows for extending the usefulness, but even a single string is fairly capable, as you can pack/unpack a JSON string in scripts.

itemName.sendCommand(command, {'optionalkey': value});

or

itemName.sendCommand(command, source);

As mentioned above, it looks like there is some existing code, but I can’t seem to read/write the source property in events through JS.