As the title says, I have migrated rules to MainUI. However, when saving the rule it does not write the output of syntax errors into the log file.
Maybe I missed something completely but I cannot find any information about this.
I agree with that.
I find it much clearer to work with text files, maybe that’s because I’ve been so used to it since OH1.
It is also clear to me that entry is much easier for newbies via the UI. But if you have a certain number of items you simply lose the overview
Hi Yannik @ysc,
sorry to bother you. Are there any settings or is there anything we can do so that the syntax is being checked when saving rules in MainUI?
sorry, I should have been clearer - was suggesting what feature you might want rather than actually see today.
If you’re typing and poking ‘save’ on the GUI you wouldn’t want to run off and inspect logs to see if it worked, surely?
I just wanted to point out that something fundamental is missing.
Let me explain what I mean:
As an example, add this faulty line to your working code:
var x = "whatever
When you save your .rules file (note: NOT executing the rule) the log result is the following:
2021-11-20 14:04:33.626 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Test2.rules'
2021-11-20 14:04:33.670 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'Test2.rules' has errors, therefore ignoring it: [6,16]: String literal is not properly closed
I can see in the log file what error I have put into my code and where.
When you save the same code in MainUI, then this is the result in your log file:
2021-11-20 14:06:12.163 [INFO ] [openhab.event.RuleUpdatedEvent ] - Rule 'GuteNacht' has been updated.
No, that’s just how the rules engine works, not the UI. Modules are just declarations that are saved and they are only evaluated when the rule is run. In case of script modules (actions or conditions) this means the script is parsed when the rule is run, not before. You can easily test-run your rule, ignoring triggers and conditions, with the Run Now button (or Ctrl-R). If you have a syntax error it will appear in the log.
If you’re not sure about actually running the code and just want to check the syntax, maybe temporarily inserting a return; statement before any sensible code would work.
I see. Thanks for clarifications.
I tested this and unfortunately you only see an import failure alarm without any further information.
What a pity. I wanted to migrate all my rules to MainUI this weekend
To me, an OH-hobbyist, I will lose a lot of functionality and comfortability. Whenever I save a rule during creation or changing a rule I immedately look into the log which provides me with important information in which line my error is and what the error is.
Don’t get me wrong - this is not at all complaining. Just sharing my thoughts.