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
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?
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 (NOTCR+LF). You can check this with Notepad++.
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
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”