Skip to content

Expose _getTriggeredData as a utility for managed rules #443

@rkoshak

Description

@rkoshak

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions