Rules declared in files not visible

Hi, in /etc/openhab/rules on a raspberry running openhab 4.x exists a file regel1.rules.
In the UI under /settings/rules/ this rule is not visible.
Content of regel1.rules

var int iMyInterger = 5
val int cMyInteger = 5
rule “Testrule”
when
Time cron “0 0 18 * * ?” // einmal täglich 18 Uhr
then
iMyInteger = iMyInteger + 1 // klappt, da variabel
end

Same behaviour with more complex rules.
owner is openhabian and rights are rwxrwxrwx

Any ideas for solution ?

Thank you

First: Please use code fences. Discourse will change some characters and in consequence, code may not be valid anymore (here: “” vs. ")
Second: There is a typo in your rule (iMyInterger vs. iMyInteger)

Please take a look at the logs. Change the file regel1.rules (for instance, add a space at end of file) and save the file. Does openHAB load the rules file?

Hey,

thanks fort he quick answer.

No information in log files.

( iMyInteger changed )

Blank added without success ( same on other files )

How do I check whether openHAB loaded the rule ?

Klaus-Dieter

Then the file isn’t loaded at all. Are you sure about path and file name?
How did you install openHAB?

Have you checked that you reach startLevel 100. Think you need at least 80 for the Rule Engine to start.

Also check:
image

If Rules are empty and startLevel not 100, do a forum search for hints.

Hi !

Installation with rasperry installer → openhabian.

Screenshot

Yes, but I was thinking of the Rules tab in the WEB UI, usually at http://:8080
But, I think you will need to inspect/post your log to show what is going on.
Should be something like: /var/log/openhab/openhab.log
(If not, the WEB UI will guide you)

If you did create the files via Windows, please check codepage and line breaks, for openHAB the file has to be UTF-8 and LF (NOT CR+LF). You can check this with Notepad++.

Screenshot 2024-03-24 214657

The longer I test OpenHAB, the less I understand it.
Now - without doing anything - I see the rule ?
Incredible and not very trustworthy and reliable ?
Any idea ?
BLEIBEN SIE GESUND Klaus-Dieter Brinkmann

Von KDBs iPad gesendet

We cannot understand much without the log. :smiling_face:

Solution : rules are only visible without any syntax error !

And there are no information in log files ! These Informations are generated only from „visible“ rules.

Well, no.

At least if a rules file is loaded at all, there is always a log line like

2024-03-28 16:06:17.438 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.rules'

or

2024-03-28 16:07:02.204 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.rules'
2024-03-28 16:07:02.215 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'test.rules' is either empty or cannot be parsed correctly!

the latter example is for a “corrupt” rule, which will prevent openHAB to use the file at all. But there is still a message about. The same is true for files which are “good enough to use most of the rules”