There is a difference between how the event Object appears in managed rules and file based rules. I file based rules the event Object is parsed out and converted from the original Java so it's much easier to get at all the information in the event. Managed users get the raw Java event Object.
While not necessary every time, it is sometimes desirable to access information from the payload and other parts of the event which is awkward and requires experimentation and investigation to figure out what is available and how to access it.
I could create a separate library which basically reproduces what _getTriggeredData does, but it would be better overall if managed rules users could just call that function directly or indirectly to convert their Java Object to the exact same event Object that file users see. While we can't intercept the event directly, at least we have the option to convert it ourselves on demand.
I'll be happy to submit a PR but don't won't if there is some technical or philosophical reasons I don't know which makes this a bad idea.
Your Environment
- openHAB version used (check Main UI -> About): OH 5.0 M4
- openhab-js version used (run
console.log('openhab-js ' + utils.OPENHAB_JS_VERSION) from a JS script): 5.11.1
- Operating System and version (e.g. desktop or mobile, Windows 10, Raspbian Buster, ...): Official Docker running on Ubuntu 24.04
There is a difference between how the
eventObject appears in managed rules and file based rules. I file based rules theeventObject is parsed out and converted from the original Java so it's much easier to get at all the information in theevent. Managed users get the raw JavaeventObject.While not necessary every time, it is sometimes desirable to access information from the
payloadand other parts of theeventwhich is awkward and requires experimentation and investigation to figure out what is available and how to access it.I could create a separate library which basically reproduces what
_getTriggeredDatadoes, but it would be better overall if managed rules users could just call that function directly or indirectly to convert their Java Object to the exact sameeventObject that file users see. While we can't intercept theeventdirectly, at least we have the option to convert it ourselves on demand.I'll be happy to submit a PR but don't won't if there is some technical or philosophical reasons I don't know which makes this a bad idea.
Your Environment
console.log('openhab-js ' + utils.OPENHAB_JS_VERSION)from a JS script): 5.11.1