-
Notifications
You must be signed in to change notification settings - Fork 786
[Automation] [JSR223] Proposal for a tiny extension of class SimpleRule #6242
Comments
Sweet, i've been wondering about that too. Hope it's not a big deal. |
Nearly same time others wondered... ;-) |
Is this in any way related to #3580? |
Not directly,
If Rule class is used directly, I would have the ability to set my own UID. But if I use SimpleRule, I can not specify my own UID. It would be very convenient to be allowed to set the UID itself. |
@lewie , out of curiousity, what use do you have in mind for a custom rule UID... would just adding the rule ID to the logging suffice? I was planning to do this, but it hasn't bugged me enough.
|
Have you tried using the rule name in addition to the description? Paper UI displays mine like this (prefixed with the script file name). Before I modified the Jython triggers.py module, they all had the name of 'triggers'. Changing the logging should be a really easy and non-intrusive update... I'll look at it this weekend if you don't get to it first. I'm polishing up a major overhaul of triggers.py to use a natural language trigger decorator (like in the Rules DSL) that will accept all of the available trigger types, and a rule decorator that includes the rule ID. Everything is working except for startup and shutdown triggers, but I haven't even gotten these working yet through the raw ESH API. Rule definition...
The module also puts the rule name in log entries when there are errors...
|
When a rule (jsr223 with javascript) is executed, in logfiles the rule uid is logged like:
I woud like to have a uid like "84eeb321-5f12-45dc-b11d-677f7c77eb1d-[ruleName or other String]"
For actions or triggers etc. from javascripts i can set their uid by ModuleBuilder.withId(uidStr) etc..
But for rules most time SimpleRule class is used, which misses a setUID function, so uid stays unset (null). Therefore uid is automatically set to a cryptic string later by RuleBuilder.create().
Is it possible to implement setUID into SimpleRule without risking anything else?
If yes, better by constructor:
or better add:
The text was updated successfully, but these errors were encountered: