New rules didnt get load after update to 2.5.6

Hello community

After upgrading to OH 2.5.6 and Buster, Im facing the issue, that new rules didnt get loaded by OH.

  • Platform information:
    • Hardware: RPi 4 (installed with openhabian)
    • OS: Buster
    • Java Runtime Environment: OH 2.5.6
  • Issue of the topic:
    After upgrading to OH 2.5.6 and OS Buster, new rule-files didnt get loaded and so the rules dont get triggered
  • Please post configurations (if applicable):
    • Items configuration related to the issue
      Switch VT_SWI_EG_Sichtschutz "Sichtschutz" (gEG, gSwitches)

    • Rules code related to the issue
      rule “Sichtschutz aktivieren”
      when
      Item VT_SWI_EG_Sichtschutz changed to ON
      then
      logInfo(“Shadowing”, “Rule triggered”)
      end

I edit the files locally on my Win10 Notebook and copy them with samba to the RPI.
Even I tried to “touch” this file to trigger the reload. But nothing happens (no entry in the log, nor firing the rule)
Already existing rules are processed as expected.

What can I check further?

Thanks in advance,
Michael

Have you tried restarting OpenHAB? That works fir many people.

What is the filename here?

Hey Bruce

Yes I tried to reboot… Not even once.
also I tried the suggestion to reload the deamons (systemctl deamon-reload)

BR
Michael

Hey Rossko

the file is named “shadowing.rules” and located at /etc/openhab2/rules.
I used “sudo touch /etc/openhab2/rules/shadowing.rules”

BR
Michael

What are the permissions on the file?

Hey Scott

It seems that the permissions were wrong.
All other rules have “openhab:openhab” and the new one had “openhabian:openhabian”. I changed the permission, but it ends in the same result (restart of OH-Service and daemon-reload done)

BR
Michael

You can test your touch process, by touching some other rules file and seeing the "refreshing rules’ message in your openhab.log

Sure your file is called shadowing.rules, and not shadowing.rule or shadowing.rules.txt (as some editors can do)

-rw-rw-r-- 1 openhab openhab 223 Mär 19 17:42 readme.txt
-rw-rw-r-- 1 openhab openhab 1220 Mai 5 16:15 presence.rules
-rw-rw-r-- 1 openhab openhab 802 Mai 16 14:13 astro.rules
-rw-rw-r-- 1 openhab openhab 2783 Mai 16 22:25 lighting.rules
-rw-rw-r-- 1 openhab openhab 1231 Jul 8 11:49 shadowing.rules
-rw-rw-r-- 1 openhab openhab 1420 Jul 8 12:07 initializing.rules

The naming and permission should be right.
I tried to touch initializing.rule. That worked.

BR Michael

If the files were created in Windows, they will have \r\n for line endings. Files created in Linux have \n for the line endings, which is what OH needs. It is best to use VS Code for creating and editing files for use in OH, using SSH to access them rather than smb. In VS Code, you can specify the type of line ending used.

Another way around this is to copy an existing file and then delete everything inside. You can also use the dos2unix utility (in Linux).

1 Like

Hello Scott

Thanks for this hint.
I’ve copied an old file, but Im gonna create a new one on linux and try it there.

Thank you!
Michael

2 Likes

Hello Scott
You were completly right.
But I needed to create a completly new file on Linux and give it a different name.
I created a “new.rules” and now it works. Even if I copy the file with samba to my Windows and back.

Thanky you very much for this great support.

BR
Michael

2 Likes