Closed JoergLaub closed 2 months ago
The answer to the "why" part of this is that the <name of .rules file>-N
is the "real name" of the rule. It's the unique identifier. The stuff you put after rule "some description of the rule"
is not guaranteed to be unique and therefore cannot be used to reference the rule.
I know that in JS Scripting and I think in jRuby and others as well, it's possible to define the UID of the rule when you define it in a text file (it's possible to define the UID for a rule in the UI no matter what rules language you are using).
So my recommendation would be to make it so users can define the UID for the rule in .rules file too.
In the mean time, as a work around, us an Item to trigger the rule instead of trying to call the rule directly from a UI widget, same as you'd have done with HABPanel or sitemaps.
I don't understand.
OH3-Doc: rule "
In all other configuration files (.items, .things) is it normal to define und use unique names as 'UID's.
Yeah, but in contrast to them rule names are allowed to contain spaces and other chars, so they are more like labels than unique identifiers.
When I define a Widget with a rule over 'Administration-Pages' the selection-list for the rules present the rule-names not UIDs - that's ok and work - why not in the YAML-code?
When you add a rule in the UI, it has a rule ID, which is the unque identifier and the label, which is what Main UI displays primarily. If you run such a rule from a page, it is referenced by its ID, the UI just displays the label when selecting the rule.
I will close this issue here, in case you still need to define the UID of a rule, please open an issue at the openhab-core repo.
Why isn't possible to reference a rule (from .rules file) in the YAML code of widget with here real name? If I configure the widget over the web interface, it's possible to select the action rule from a list with the real name of the rule. Then the YAML code use the 'number' of this rule in the rulefile.... it works :-( Then I tryed to use the 'original' rule name in the YAML code - HHTP unknown error... I have over 100 rules in my 'old' OH2 configuration (.rules) and so it is not possible to use them usefully in the pages. Any correction in the *.rules destroy the main rule-system.